Number.isFinite
isFinite –
Description
Number.isFinite(mixed variable)
Parameters
Name |
Description |
Type |
Default |
Optional |
variable |
|
mixed |
|
No |
Return values
Returns true if the value is not a number, otherwise false.
Changelog
Version |
Description |
ES 6 |
Introduced. |
Examples
Example #1 – isFinite example
console.log(Number.isFinite(NaN)); // false
console.log(Number.isFinite("string")); // false
console.log(Number.isFinite("12")); // true
console.log(Number.isFinite(12)); // true
console.log(Number.isFinite(12.42)); // true
console.log(Number.isFinite("")); // true
console.log(Number.isFinite("\n\t")); // true
console.log(Number.isFinite(null)); // true
console.log(Number.isFinite(true)); // true
console.log(Number.isFinite(undefined)); // false
console.log(Number.isFinite(Infinity)); // false
External references