Open In App
Related Articles

JavaScript isFinite() Function

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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.

Example: In this example, we will check for some numbers if they are finite or not using the isFinite() function of javascript.

Javascript

<script>
    console.log(isFinite(12));
    console.log(isFinite(0));
    console.log(isFinite(12.3));
    console.log(isFinite("Geeks"));
    console.log(isFinite("456"));
    console.log(isFinite(-46));
</script>

                    

Output:

true
true
true
false
true
true

We have a complete list of Javascript Functions, to check those please go through this Javascript Function Complete reference article.

Supported Browsers:

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

Last Updated : 30 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads