NaN

Try it yourself:


NaN: not a number

NaN represents an invalid or undefined numeric result. It can arise from failed parsing or undefined arithmetic.

Handling NaN

Test it with isNaN(), reject exceptional values with isFinite(), and validate type with isNumeric(). Use nullish() only for missing values, not every invalid number.

Caveat

Do not identify NaN with ordinary equality; use the dedicated predicate.

All constants