NaN
Number
class property
JS Home <<
JS Reference <<
Number <<
NaN
Description
Represents the value Not-A-Number.
- Like all class properties
NaN
should be used on the class rather than an instance of the class.
Syntax
Signature | Description |
---|---|
Number.NaN | Represents the value Not-A-Number. |
Parameters
None.
Examples
Below are some examples showing comparisons of using Number.NaN
and an unobtainable result.
var nanValues = new Array(4);
nanValues[0] = Number.NaN == Number.NaN; // NaN not equal
nanValues[1] = Number.NaN === Number.NaN; // NaN not strict
nanValues[2] = Number.NaN(isNaN); // check against isNaN
nanValues[3] = Number.POSITIVE_INFINITY * 0; // unobtainable
alert(nanValues);
Related Tutorials
JavaScript Advanced Tutorials - Lesson 3 - Number