Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Functions:isFinite

From MDC


Contents

[edit] Summary

Core Function

Evaluates an argument to determine whether it is a finite number.

[edit] Syntax

isFinite(number)

[edit] Parameters

number 
The number to evaluate.

[edit] Description

isFinite is a top-level function and is not associated with any object.

You can use this method to determine whether a number is a finite number. The isFinite method examines the number in its argument. If the argument is NaN, positive infinity or negative infinity, this method returns false, otherwise it returns true.

[edit] Examples

[edit] Example: Using isFinite

You can check a client input to determine whether it is a finite number.

if (isFinite(ClientInput)) {
   /* take specific steps */
}

[edit] See also

Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY