Infinity (Constant/static)

A literal constant whose type is a built in primitive value.


ECMAScript edition - 2
JavaScript - 1.3
JScript - 3.0
Internet Explorer - 4.0
Netscape - 4.06
Property/method value type:Number primitive
JavaScript syntax:-Infinity

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.


See also:Arithmetic constant, Exception, Global object, Global special variable, isFinite(), NaN, Number, Number, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY, Range error, Special number values, Value property, Zero value

Property attributes:



ECMA 262 edition 2 - section - 4.3.22

ECMA 262 edition 2 - section -

ECMA 262 edition 3 - section - 4.3.22

ECMA 262 edition 3 - section -

Wrox Instant JavaScript - page - 14