JavaScript Infinity Property
Infinity is a numeric value larger than any other number. It is the result of overflowing calculations such as 1 / 0.
Description
The global Infinity property is a number representing positive infinity, greater than any other number; -Infinity is its negative. It results from dividing a non-zero number by zero and from calculations that exceed Number.MAX_VALUE. It's also a handy starting value when searching for a minimum.
Infinity behaves as you'd expect mathematically: any finite number divided by it is 0, and Infinity - Infinity is NaN. Number.POSITIVE_INFINITY and Number.NEGATIVE_INFINITY are the same values under longer names.
JSON.stringify() turns Infinity into null, so it doesn't survive a round trip through JSON. Use Number.isFinite() to check that a calculated value is an ordinary number.
Syntax
InfinityValue
The numeric value Infinity.
Example
Browser Support
The following information will show you the current browser support for the Infinity property. Hover over a browser icon to see the version that first introduced support for this property.
Desktop





Tablets & Mobile





