JavaScript: isNaN

By Xah Lee. Date: . Last updated: .

isNaN is the value of the property key "isNaN" of the Global Object.

console.log( window["isNaN"] === isNaN  ); // true


isNaN( arg )
Converts arg to number first, and return true if it is NaN, else, false. [see NaN]
console.log( isNaN( NaN ) ); // true
console.log( isNaN( "NaN" ) ); // true

console.log( isNaN( "3" ) ); // false
console.log( isNaN( 3 ) ); // false
console.log( isNaN( Infinity ) ); // false

isNaN vs Number.isNaN

isNaN and Number.isNaN are different.

The global isNaN will convert the arg first. Number.isNaN does not. [see Number.isNaN]

∑ JS in Depth

JS in Depth

JS Obj Reference


JS Obj Reference

Global Object

Constant Literals

Simple Functions

Static Objects

Primitive Wrapper

Special Objects

Error Objects