JavaScript Number isFinite()
Examples
Is 123 finite?
Number.isFinite(123)
Try it Yourself »
Number.isFinite("123")
Try it Yourself »
Definition and Usage
The Number.isFinite()
method returns
true
if a number is a finite number.
Infinite (not finite) numbers are Infinity
,
-Infinity
, or NaN
Otherwise it returns false
.
See Also:
Difference Between isFinite() and Number.isFinite()
isFinite()
returns true
if a value is a finite number.
Number.isFinite()
returns true
if a number is a finite number.
In other words:
isFinite()
converts the value to a number before testing it.
Examples
// This returns true
isFinite(123)
Try it Yourself »
// This returns false
Number.isFinite("123")
Try it Yourself »
Syntax
Number.isFinite(value)
Parameters
Parameter | Description |
value | Required. The value to be tested. |
Return Value
Type | Description |
A boolean | true if the value is a finite Number, otherwise false . |
More Examples
Number.isFinite(+1.23)
Number.isFinite(-1.23)
Number.isFinite('2005/12/12')
Try it Yourself »
Number.isFinite(5-2)
Number.isFinite(5/2)
Number.isFinite(0)
Number.isFinite(0/0)
Number.isFinite(Infinity)
Number.isFinite(-Infinity)
Number.isFinite(NaN)
Try it Yourself »
Browser Support
Number.isFinite()
is an ECMAScript6 (ES6) feature.
ES6 (JavaScript 2015) is supported in all modern browsers:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
Number.isFinite()
is not supported in Internet Explorer 11 (or earlier).