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

Syntax

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
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Static Objects

Primitive Wrapper

Special Objects