The isFinite() function determines whether a number is a finite, legal number.
The isFinite() function determines whether a number is a finite, legal number.
This function returns false if the value is +infinity, -infinity, or NaN (Not-a-Number), otherwise it returns true.
isFinite(value)
Parameter | Require | Description |
---|---|---|
value | Required. | The value to be tested |
A Boolean. Returns false if the value is +infinity, -infinity, or NaN, otherwise it returns true.
Check whether a number is a finite, legal number:
var a = isFinite(124) + "\n"; var b = isFinite(-1.24) + "\n"; var c = isFinite(5 - 2) + "\n"; var d = isFinite(0) + "\n"; var e = isFinite("123") + "\n"; var f = isFinite("dead") + "\n"; var f = isFinite("book2s.com") + "\n"; var g = isFinite("2010/12/12"); var res = a + b + c + d + e + f + g; console.log(res);//from w w w .j a v a2s.c om