Number.NaN

JavaScript 1.1+, ECMAScript 1.0+, JScript 1.0+ Nav3+, NES2+, IE 3+, Opera3+ Syntax

Number.NaN

Description

The NaN property of the Number object represents a value that is not equal to any numeric value.

Example

Listing 6.184 shows how to use the NaN property. An integer constant, 123, is compared to the NaN constant to see if it is a numeric value or not.

Listing 6.184 Example of NaN Property
<html>
<body>

<script language="JavaScript">
<!–– Hide
// checks to see if 123 is a number or not

if(123 == Number.NaN){
     document.write("This is not a number");
}
// End Hide ––>
</script>

</body>
</html>
							
							
						

Get Pure JavaScript 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.