Easy Tutorial
❮ Prop Button Type Prop Style Aligncontent ❯

JavaScript Infinity Property


Definition and Usage

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

Negative infinity is a numeric value representing negative infinity.

In JavaScript, a value exceeding 1.797693134862315E+308 is considered Infinity, and a value less than -1.797693134862316E+308 is considered negative infinity.


Browser Support

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

Examples

Output a number exceeding positive infinity:

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

The output of the above example:

Infinity

Example

Output a number exceeding negative infinity:

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

The output of the above example:

-Infinity

❮ Prop Button Type Prop Style Aligncontent ❯