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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>

chevron_right


Output:
Before Click:
BERJAYA
After Click:
BERJAYA

Browser Support: The listed browsers support JavaScript Infinity property-

  • Google Chrome
  • Firefox
  • Internet Explorer
  • Opera
  • Safari


My Personal Notes arrow_drop_up

BERJAYA
Check out this Author's contributed articles.

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.