Example 1 — Read Number.NaN
Print the constant and confirm it matches global NaN.
console.log(Number.NaN);
console.log(Object.is(Number.NaN, NaN)); How It Works
- Static access. Read
Number.NaNon the constructor — there is no(5).NaN. - Prints as NaN. Consoles show the special Not-A-Number token.
- Same value.
Object.isconfirms it is the same as globalNaN. - Why Object.is?
===cannot prove sameness for NaN — more on that next.

