isNaN
Summary
Determines whether a supplied number is NaN (not a number).
Syntax
isNaN(numValue)
- numValue
- Required. the value to be tested against NaN
Return Value
true if the value, converted to the Number type, is the NaN; otherwise false.
Examples
isNaN(100); // false
isNaN("100"); // false
isNaN("ABC"); // true
isNaN("10C"); // true
isNaN("abc123"); // true
isNaN(Math.sqrt(-1)); // true
Remarks
You typically use this method to test return values from the parseInt and parseFloat functions.
Alternatively, a variable that contains NaN or another value could be compared to itself. If it compares as unequal, it is NaN. This is because NaN is the only value that is not equal to itself.
See also
Other articles
Attributions
Microsoft Developer Network: Article