JavaScript Number isFinite()
Examples
Is 123 finite?
Number.isFinite(123)
Try it Yourself »
Number.isFinite("123")
Try it Yourself »
Description
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 since June 2017:
Chrome 51 | Edge 15 | Firefox 54 | Safari 10 | Opera 38 |
May 2016 | Apr 2017 | Jun 2017 | Sep 2016 | Jun 2016 |
Number.isFinite()
is not supported in Internet Explorer.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.