The global isFinite()
function determines whether the passed value is a finite number. If needed, the parameter is first converted to a number.
isFinite(testValue)
testValue
false
if the argument is (or will be coerced to) positive or negative Infinity
or NaN
or undefined
; otherwise, true
.
isFinite
is a function property of the global object.
You can use this function to determine whether a number is a finite number. The isFinite
function examines the number in its argument. If the argument is NaN
, positive infinity, or negative infinity, this method returns false
; otherwise, it returns true
.
isFinite(Infinity); // false isFinite(NaN); // false isFinite(-Infinity); // false isFinite(0); // true isFinite(2e64); // true isFinite(910); // true isFinite(null); // true, would've been false with the // more robust Number.isFinite(null) isFinite('0'); // true, would've been false with the // more robust Number.isFinite("0")
Desktop | ||||||
---|---|---|---|---|---|---|
isFinite |
1 | 12 | 1 | 4 | 3 | 1 |
Mobile | ||||||
---|---|---|---|---|---|---|
isFinite |
1 | 18 | 4 | 10.1 | 1 | 1.0 |
Server | |
---|---|
isFinite |
0.1.100 |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite