JavaScript isFinite() function
- Previous Page Infinity
- Next Page isNaN()
- Go to the Previous Level JavaScript Global Reference Manual
Definition and usage
isFinite()
The function can determine whether a number is a finite valid number.
If the value is +infinity, -infinity, or NaN (not a number), this function returns false; otherwise, it returns true.
Example
Check if the number is a finite valid number:
var a = isFinite(123) + "<br>"; var b = isFinite(-1.23) + "<br>"; var c = isFinite(5-2) + "<br>"; var d = isFinite(0) + "<br>"; var e = isFinite("123") + "<br>"; var f = isFinite("Hello") + "<br>"; var g = isFinite("2005/12/12"); var res = a + b + c + d + e + f + g;
Syntax
isFinite(value)
Parameter value
Parameter | Description |
---|---|
value | Required. The value to be tested. |
Technical details
Return value: | Boolean value. If the value is +infinity, -infinity, or NaN, it returns false; otherwise, it returns true. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Function | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
isFinite() | Support | Support | Support | Support | Support |
- Previous Page Infinity
- Next Page isNaN()
- Go to the Previous Level JavaScript Global Reference Manual