POSITIVE_INFINITY

A special numeric value representing infinity. This value is displayed as Infinity.

Property of

Number

Description

This value behaves mathematically like infinity; for example, anything multiplied by infinity is infinity, and anything divided by infinity is 0.

JavaScript does not have a literal for Infinity.

POSITIVE_INFINITY is a static, read-only property of Number. As a result, you always use it as Number.POSITIVE_INFINITY, rather than as a property of a Number object you create.

Example

In the following example, the variable bigNumber is assigned a value that is larger than the maximum value. When the if statement executes, bigNumber has the value Infinity, so the func1 function is called.

var bigNumber = Number.MAX_VALUE * 10
if (bigNumber == Number.POSITIVE_INFINITY)
      func1()
else
      func2()