This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

NaN

Summary

A special constant that specifies a value that is Not-A-Number

Syntax

NaN

Examples

NaN mainly occurs when parsing goes wrong

parseInt(123); // 123
parseInt("123"); // 123
parseInt('foo'); // NaN

NaN does not equal NaN, use the isNaN Function instead to test if a value is not a number

NaN === NaN; // false
isNaN(NaN); //true

Remarks

The NaN constant is a member of the Global object, and is made available when the scripting engine is initialized.

See also

Other articles

Attributions

  • Microsoft Developer Network: Article