Infinity is of two types - Positive and Negative, So if calculation go beyond the upper of lower limit it shows infinity. In our example, We are going to show negative and positive infinity both in span.
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p>2.797693439493157E+10308 will show the positive infinity and -1.7976931348623157E+10308 will show the negetive infinity .</p> <p>Click the button to see for yourself.</p> <button onclick="infinity()">Click it</button> <p id="sample"></p> <script> function infinity() { document.getElementById("sample").innerHTML = 2.797693439493157E+10308 + "<br>" + -1.7976931348623157E+10308; } </script> </body> </html>