Object is() method

Find out all the information about the JavaScript is() method of the Object object

This method was introduced in ES2015. It is designed to help compare value.


Object.is(a, b)

The result is alwaysfalseunless:

  • awithbAre exactly the same object
  • awithbEqual strings (when composed of the same characters in the same order, the strings are equal)
  • awithbEqual to numbers (the numbers are equal when the numbers are equal)
  • awithbAllundefined, Bothnull, BothNaN, BothtrueOr bothfalse

0with-0Are different values in JavaScript, so please pay attention in this special case (convert everything to+0use+Unary operator before comparison).

Download mine for freeJavaScript beginner's manual

More js tutorials: