Re:Javascript's NaN
by some-1 on Monday September 24, 2012 @03:55PM
(#4566618)
No, the correct way is to use the global function isNaN(x);
[ Parent
| on HN ]
isNaN will return true for NaN and all values that coerce to it. The equals check will test ONLY for NaN itself:
var x = "a";
isNaN(x); // true
(x === x) === false // false
x = NaN
isNaN(x); // true
(x === x) === false // true