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.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

JavaScript Basics

JavaScript Basics

JavaScript Intermediate

JavaScript Intermediate

JavaScript Advanced

JavaScript Advanced

JavaScript Reference

JavaScript Entities

Globals

Number

MIN_VALUE
NaN
NEGATIVE_INFINITY
POSITIVE_INFINITY
prototype
Instance Properties
constructor
Class Methods
None.
Instance Methods Getters
toExponential()
toFixed()
toLocaleString()
toPrecision()
toString()
valueOf()
Instance Methods Setters
None.

Statements

Operators