Number.isNaN()

Determines whether the passed value is the NaN value.

Since ES2015 Spec ↗

Syntax

Number.isNaN(value)

Parameters

NameTypeRequiredDescription
value any Yes The value to test.

Returns

boolean — true if the value is exactly NaN; otherwise false.

Examples

console.log(Number.isNaN(NaN), Number.isNaN(0 / 0));
Output
true true
console.log(Number.isNaN('abc'), isNaN('abc'));
Output
false true

Notes

Safer than the global `isNaN`, which coerces its argument (so `isNaN('abc')` is true). This returns true only for the actual NaN value.

Browser & runtime support

EnvironmentSince version
chrome 25
firefox 15
safari 9
edge 12
node 0.10

See also