The primitive value Infinity represents the positive infinite number value.

In JavaScript you can use the values positive infinity and negative infinity. They make reference to a global special variable called Infinity, and you can place an optional unary plus or unary minus in front to yield the positive and negative extremes.

If you are in an environment that does not have the `Infinity` value implemented, then you may be able to create one yourself like this:

`var Infinity = 1e300 * 1e300;`

You can check for infinity values with `Number.POSITIVE_INFINITY` and `Number.NEGATIVE_INFINITY`. They should be identical to Infinity and -Infinity which are properties of the `Global` object.

Note that although the type of result when testing the value `Infinity` or the copies available from the `Number` object is number, the value will print as "`Inf`" when displayed with a `document.write()` method.

This constant is available as a property of the

`Global`object in MSIE version 4 but not in Netscape 4.This is not available for use server-side with Netscape Enterprise Server 3.

Note that you can assign a new value to the

`Infinity`property on some browsers. This is somewhat dangerous and may cause unpredictable results later on.

ECMA 262 edition 2 - section - 4.3.22

ECMA 262 edition 2 - section - 15.1.1.2

ECMA 262 edition 3 - section - 4.3.22

ECMA 262 edition 3 - section - 15.1.1.2

Wrox Instant JavaScript - page - 14

Prev | Home | Next |

Increment value (++) | Up | Inheritance |

JavaScript Programmer's Reference, Cliff WoottonWrox Press (www.wrox.com)Join the Wrox JavaScript forum at p2p.wrox.comPlease report problems to support@wrox.com© 2001 Wrox Press. All Rights Reserved. Terms and conditions. |