NaN
suggest changeNaN stands for “Not a Number.” It is the result of an operation that should produce a number but cannot, such as 0 / 0 or Math.sqrt(-1). Division by zero yields Infinity, not NaN.
It is a property of the global object, and a reference to Number.NaN.
globalThis.hasOwnProperty("NaN"); // true
NaN; // NaN
Perhaps confusingly, NaN is still considered a number.
typeof NaN; // 'number'
Don’t check for NaN using the equality operator. See Testing for NaN using isNaN instead.
NaN == NaN // false
NaN === NaN // false
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents