The JavaScript isFinite Function

The JavaScript isFinite global function determines whether a value is a finite number.

All numbers in JavaScript are 64-bit floating point numbers which yields a range of 5e-324 (Number.MIN_VALUE) to 1.7976931348623157e+308 (Number.MAX_VALUE). Any number that exceeds the lower or upper limit of the floating point numbers is considered infinite. The isFinite function can be used to determine whether a given value is within the allowed range for a floating point number.

The isFinite function tries to convert the value to a number. If the result is NaN, positive infinity (Infinity) or negative infinity (-Infinity), isFinite returns false. Otherwise, it returns true.


var is_finite = isFinite(value);


The value being evaluated


isFinite(42); // true
isFinite(Math.sqrt(-4)); // false
isFinite("I am not a number, I am a free man."); // false

See also

If you see a typo, want to make a suggestion or have anything in particular you'd like to know more about, please drop us an e-mail at hello at diveintojavascript dot com.

Copyright © 2010-2013 Dive Into JavaScript