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.

Use Na N in a calculation

Enter NaN on a calculator line to see its built-in value, or place the name inside a longer expression. Keep any displayed unit attached when converting or combining physical quantities, and check that every other value uses a compatible dimension.

The example above is editable, so you can replace surrounding values and test the constant in your own formula. Browse all constants to compare related values and notation.

All constants