Object.is

Returns true if the values are the same value, false otherwise.

It is similar to the strict equality operator (===), but considers NaN to be equal to NaN, and -0 to be different from 0.

Syntax

is(a, b)

Parameters

Return value

A boolean.

Examples

Object.is(42, 42)
true
Object.is(42, '42')
false
Object.is(NaN, NaN)
true
Object.is(0, -0)
false