Favorites

JavaScript Number.isNaN() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Number.isNaN()
JavaScript Number Static methodThis method is supported by all modern browsers.
Updated 28th November 2026

The Number.isNaN() static method checks whether a value is NaN, without the confusing type conversion of the global isNaN().

Description

The Number.isNaN() static method returns true only if the value is NaN. It's needed because NaN isn't equal to anything, even itself, so x === NaN never works. The global isNaN() converts its argument to a number first, so isNaN('hello') is true; Number.isNaN('hello') is false.

NaN shows up when a calculation or conversion fails, such as Number('abc'), parseInt('px'), Math.sqrt(-1) or 0 / 0. Because it spreads through any arithmetic it's involved in, checking for it as soon as a value is converted stops it from quietly breaking later calculations.

Object.is(value, NaN) also detects it, and value !== value is an old trick that works because NaN is the only value not equal to itself. Like other static members of Number, it is called on the Number constructor itself, not on individual number values.

Syntax

Number.isNaN(value)

Parameters

  • valueThe value to check.

Return Value

true if the value is NaN, otherwise false.

Example

console.log(Number.isNaN(NaN));
console.log(Number.isNaN(0 / 0));
console.log(Number.isNaN('hello'), isNaN('hello'));
console.log(NaN === NaN);

Browser Support

The following information will show you the current browser support for the Number.isNaN() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee