Appendix C. JavaScript Global Properties

In addition to the global objects, there are a few simple global properties made available to your programs as well.

Table C.1. List of Properties

Property Name

Support

Description

Infinity

CH1+, FF1+, IE4+, NN4+, O3+, SF1+

A number representing infinity.

NaN

CH1+, FF1+, IE4+, NN4+, O3+, SF1+

Returns a special value that indicates something is not a number.

undefined

CH1+, FF1+, IE5.5+, NN4+, O3+, SF1+

A value indicating an identifier is not defined.

Infinity

Standard: JavaScript 1.3+, JScript 3.0+, ECMAScript 1.0+

Support: Google Chrome Beta+, Firefox 1.0 (Gecko 1.7)+, Internet Explorer 4.0+, Netscape Navigator 4.0+, Opera 3.0+, Safari 1.0+

Syntax

Infinity

Description

A number representing infinity. Both Infinity and NaN are members of the Number object.

Example

<script>

var myVal = Infinity*Infinity;

document.write(myVal + "<br />"); // Infinity

myVal = 1/Infinity; // Should be zero

document.write(myVal); // 0

</script>

NaN

Standard: JavaScript 1.3+, JScript 3.0+, ECMAScript 1.0+

Support: Google Chrome Beta+, Firefox 1.0 (Gecko 1.7)+, Internet Explorer 4.0+, Netscape Navigator 4.0+, Opera 3.0+, Safari 1.0+

Syntax

NaN

Description

Returns a special value that indicates something is not a number. Both Infinity and NaN are members of the Number object.

Example

<script>

document.write(NaN); // NaN

</script>

undefined

Standard: JavaScript 1.3+, JScript 5.5+, ECMAScript 1.0+

Support: Google Chrome Beta+, Firefox 1.0 (Gecko 1.7)+, Internet Explorer 5.5+, Netscape Navigator 4.0+, ...

Get JavaScript® Programmer's Reference 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.