myGlobal.isNaN( num ) in ECMAScript 262

Returns true if the supplied number is NaN, false otherwise.

Arguments

nametypedescription
num Number The number to check.
Return Type
Boolean

Description

The global function checks if a number object is a valid number (including Infinity and -Infinity instead of NaN (the value given to results which are Not a Number). Although the global NaN value exists, comparisons to it will never evaluate to true...even when compared to itself! To test if a value is NaN, use this function.

var result = 12 * 'apple';
if (isNaN(result)){
    //this code will occur; result is NaN
}
if (result==NaN){
    //this code will NOT occur; result is NaN, but cannot be compared to NaN
}