Name

Number.NaN Property — constant representing invalid numeric data (Not-a-Number)

Availability

Flash 5

Synopsis

Number.NaN

Access

Read-only

Description

The NaN property stores the special “invalid number” value of the number datatype. It is used to represent the result of an illogical mathematical calculation (e.g., 0/0) or an attempted data conversion that does not yield a legitimate number.

Number.NaN is normally used in its more convenient global property form, NaN.

Usage

The value NaN is hardly ever used directly in source code but rather serves as a way for an operation to return an error condition. The only way you can detect NaN is with the global function isNaN( ).

See Also

isNaN( ), NaN; Section 4.3.3 in Chapter 4

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.