NEGATIVE_INFINITY

A special numeric value representing negative 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.

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

Examples

In the following example, the variable smallNumber is assigned a value that is smaller than the minimum value. When the if statement executes, smallNumber has the value -Infinity, so the func1 function is called.

var smallNumber = -Number.MAX_VALUE*10
if (smallNumber == Number.NEGATIVE_INFINITY)
      func1()
else
      func2()