isFinite()
global function
JS Home <<
JS Reference <<
isFinite()
Global function finite test.
Description
Evaluates the passed argument to see if it is finite.
Syntax
Signature | Description |
---|---|
isFinite(number) | Evaluates the passed argument to see if it is finite. |
Parameters
Parameter | Description |
---|---|
number | The numerical value you want to evalute:
|
Examples
Below are some examples of using the isFinite()
function.
// The isFinite method returns true for all values except +/- infinity and NaN.
var isFiniteValues = new Array(5);
isFiniteValues[0] = isFinite(Number.NEGATIVE_INFINITY);
isFiniteValues[1] = isFinite(Number.POSITIVE_INFINITY);
isFiniteValues[2] = isFinite(NaN);
isFiniteValues[3] = isFinite(-123456789);
isFiniteValues[4] = isFinite(123.456);
alert(isFiniteValues);
Related Tutorials
JavaScript Advanced Tutorials - Lesson 3 - Number