Favorites

JavaScript NaN Property

☕
Enjoying this site?

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

Buy us a coffee
NaN
JavaScript Global propertyThis property is supported by all modern browsers.
Updated 28th November 2026

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

NaN

Value

The numeric value NaN.

Example

console.log(0 / 0, Number('abc'));
console.log(NaN === NaN);
console.log(Number.isNaN(Number('abc')));
console.log(typeof NaN);
console.log(5 + NaN);

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.

This property 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