Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
karthikeya Boyini

The isInteger() function of the Number object accepts a number and determines if it is finite number. If the given number is finite it returns true else, it returns false.

Syntax

Its Syntax is as follows

Number.isInteger(100/0); 

Example

Live Demo

<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script type="text/javascript">
         var result = Number.isFinite(100/0);
         if(result) {
            document.write("Given number is finite");
         }else {
            document.write("Given number is infinite");
         }
      </script>
   </body>
</html>

Output

Given number is infinite

Example

In addition to equation you can also pass positive number, negative number, zero and an equation as a parameter to this function.

Live Demo

<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script type="text/javascript">
         var result1 = Number.isFinite(45);
         document.write(result1);
         document.write("<br>");
         var result2 = Number.isFinite(-38);
         document.write(result2);
         document.write("<br>");
         var result3 = Number.isFinite(0);
         document.write(result3);
         document.write("<br>");
         var result4 = Number.isFinite("Tutorialspoint");
         document.write(result4);
      </script>
   </body>
</html>

Output

true
true
true
false

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.