JS Built-ins
NumberNaNbeginner

Number.NaN β€” NaN is not equal to itself

πŸ“– Usage Example
// Represents Not-a-Number
Number.NaN        // β†’ NaN
Number.isNaN(Number.NaN)  // β†’ true
Number.NaN === Number.NaN // β†’ false (NaN is never equal to itself)

Use Number.NaN as a named constant for Not-a-Number; always check for it with Number.isNaN() since NaN !== NaN.

Number.NaN

Number.NaN is the same as the global NaN. One unique property: NaN !== NaN.

Number.NaN === Number.NaN  // β†’ false!
πŸ’‘ Hints (1)
  • β€’ `NaN` is the only JavaScript value not equal to itself β€” use `Number.isNaN()` to check for it.