Skip to content
Related Articles

Related Articles

JavaScript isFinite() Function

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 02 Dec, 2021

The JavaScript isFinite() function is used to check whether a number is a finite, legal number or not. It returns true for all the values except +infinity, -infinity, or NaN.

Syntax:

isFinite(value)

Parameters: This method takes a single parameter as mentioned above and discussed below:

  • value: It is a required value passed in the isFinite() function.

Return Value: It returns a Boolean value i.e. returns false if the value is +infinity, -infinity, or NaN, otherwise returns true.

Javascript




<!DOCTYPE html>
<html>
 
<body>
     
<p>JavaScript isFinite() Function</p>
 
 
    <script>
        document.write(isFinite(12) + "<br>");
        document.write(isFinite(0) + "<br>");
        document.write(isFinite(12.3) + "<br>");
        document.write(isFinite("Geeks") + "<br>");
        document.write(isFinite("456") + "<br>");
        document.write(isFinite(-46) + "<br>");
    </script>
</body>
 
</html>

Output:

Supported Browsers:

  • Chrome 1 and above
  • Firefox 1 and above
  • Edge 12 and above
  • Opera 3 and above
  • Safari 1 and above

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!