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
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
30 Dec, 2022
Like Article
Save Article