home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Number.NaN Constant

Name

Number.NaN Constant---the special Not-a-Number value

Availability

Navigator 3.0

Synopsis

Number.NaN

Description

Number.NaN is a special value that indicates that the result of some arithmetic operation (such as division by zero) or mathematical function is "Not-a-Number." parseInt() and parseFloat() return this value when they cannot parse the specified string, and you might use Number.NaN in a similar way to indicate an error condition for some function that normally returns a valid number.

JavaScript prints the Number.NaN value as NaN. Note that the NaN value always compares unequal to any other number, including NaN itself. Thus, you cannot check for the Not-a-Number value by comparing to Number.NaN. Use the isNaN() function instead.


Previous Home Next
Number.MIN_VALUE Book Index Number.NEGATIVE_INFINITY

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell