JS: Object.is
(new in JS: ECMAScript 2015)
Object.is(value1, value2)
-
return true if two values are equal.
similar to Triple Equal Operator , but can distinguish negative zero and positive zero, and two NaN are considered equal.
// negative zero and positive zero console.log(Object.is(-0, +0) === false); console.log((-0 === +0) === true);
// testing equality of two NaN console.log(Object.is(NaN, NaN) === true); console.log((NaN === NaN) === false);