JavaScript NaN Property
NaN means Not-a-Number. It is the result of a failed or undefined mathematical operation, and it isn't equal to anything, even itself.
Description
The global NaN property is a special Number value meaning Not-a-Number. It appears when a calculation has no meaningful numeric result, such as 0 / 0, Math.sqrt(-1) or Number('abc'). Any arithmetic involving NaN produces NaN, so it tends to spread through calculations.
NaN is the only value not equal to itself, so x === NaN is always false. Use Number.isNaN(x) to test for it. Despite its name, typeof NaN is "number".
Number.NaN is the same value. Because arithmetic with NaN always gives NaN, a single bad input, such as an empty form field converted with parseInt(), can silently turn a whole total into NaN; checking values as soon as they're converted makes such bugs easier to track down.
Syntax
NaNValue
The numeric value NaN.
Example
Browser Support
The following information will show you the current browser support for the NaN property. Hover over a browser icon to see the version that first introduced support for this property.
Desktop





Tablets & Mobile





