JavaScript & jQuery Tutorials

JS Home Right Arrow JS Reference Right Arrow Number Right Arrow NaN

NaN  Number  class property

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.NaNRepresents 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);

Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 3 - Number



  

go to home page Homepage go to top of page Top