JavaScript InfinityProperty

函数参考手册JavaScript Global Functions

Definition and Usage

The Infinity property is used to store a numeric value representing positive infinity.

Negative infinity is a numeric value representing negative infinity.

In JavaScript, values exceeding1.797693134862315E+308are Infinity, and values less than-1.797693134862316E+308are negative infinity.


Browser Support

Chrome IE Edge Firefox Safari Opera
Yes Yes Yes Yes Yes Yes

Example

Example

Output a number exceeding positive infinity:

let x = 1.797693134862315E+308; let y = x * 1.001;

The output of the above example is:

Infinity

Try it Yourself »

Example

Output a number exceeding negative infinity:

let x = -1.797693134862316E+308; let y = x * 1.001;

The output of the above example is:

-Infinity

Try it Yourself »


函数参考手册JavaScript Global Functions Other Extensions