The Javascript isFinite()
function checks if a value is a finite number.
If needed, the parameter is converted to a number.
It returns false if the argument is positive or negative Infinity or NaN or undefined.
Otherwise, true.
isFinite(testValue)
Parameters | Meaning |
---|---|
testValue | The value to be tested for finiteness. |
let a = isFinite(Infinity); console.log(a);// w ww . ja v a 2s .c o m a = isFinite(NaN); console.log(a); a = isFinite(-Infinity); console.log(a); a = isFinite(0); console.log(a); a = isFinite(2e64); console.log(a); a = isFinite(910); console.log(a); a = isFinite(null); console.log(a); a = isFinite('0'); console.log(a);