JavaScript | Infinity Property
The Infinity Property used to display Infinity when the floating point no.’s upper limit is exceeded and -Infinity when the floating point no.’s lower limit is exceeded. Here, Infinity denotes Positive Infinity and -Infinity represents Negative Infinity.
Syntax:
floating point no.
Return Value: It returns Infinity to represent Positive Infinity and -Infinity to represent Negative Infinity.
Example:
<!DOCTYPE html> <html> <head> <style> h1 { color: green; } </style> </head> <body> <center> <h1> Geeks </h1> <button onclick="test()"> Press </button> <p> 3.4576917263943217389012348562315E+1203466 is the limit of a Floating Point Number.</p> <h4> Clicking the Press button will showcase the Javascript Infinity Property. </h4> <p id="gfg"></p> <script> function test() { document.getElementById( "gfg").innerHTML = -3.4576917263943217389012348562315E+1203466 + "<br>" + 3.4576917263943217389012348562315E+1203466; } </script> </center> </body> </html> |
Output:
Before Click:

After Click:

Browser Support: The listed browsers support JavaScript Infinity property-
- Google Chrome
- Firefox
- Internet Explorer
- Opera
- Safari
Recommended Posts:
- What is positive infinity in JavaScript?
- What is negative infinity in JavaScript?
- How to check if a number evaluates to Infinity using JavaScript ?
- JavaScript | Error name Property
- Javascript | MouseEvent which Property
- JavaScript | undefined Property
- JavaScript | Math.PI Property
- How to remove CSS property using JavaScript?
- JavaScript | global Property
- JavaScript | lastIndex Property
- JavaScript | Cursor property
- JavaScript | source Property
- JavaScript | Math.LN2 property
- JavaScript | multiline Property
- JavaScript | MouseEvent Button Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


