jskatas.org Continuously Learn JavaScript. Your Way.

Number API: Number.isNaN()

Number.isNaN() determines if a value is NaN.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

The function Number.isNaN()

  • is a static function on Number

returns false

for any not-Number type

  • like null
  • like a string
  • like an object
different to the global isNaN function (specified in ES1)
  • an object gets converted to a Number before the check, and returns true therefore
  • a string gets converted to a Number first, and returns true therefore (even though its not NaN)

for real Numbers

  • like 0
  • or Infinity (+∞)
  • or the biggest Number (9007199254740991 (2^53−1))
  • or a decimal number

returns true for

  • exactly NaN
  • the result of zero divided by zero
  • something which seems not to be a number


Description of `Number.isNaN` in the specification.
Description of `Number.MAX_SAFE_INTEGER` in the spec.
Description of `Number.POSITIVE_INFINITY` in the spec.
The (old) global `isNaN` function, that behaves a bit different.
The place where `Math.PI` is specified.