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


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]

JavaScript in Depth

JS Obj Reference

Global Object

Special Objects

Static Objects

Primitive Wrapper

Constant Literals

Simple Functions

Error Objects