JavaScript isFinite() Function
The isFinite() function checks whether a value is a finite number after converting it to a number.
Description
The global isFinite() function converts the value to a number and returns false if the result is NaN, Infinity or -Infinity. Use Number.isFinite() to check values without the type conversion.
Because of the conversion, isFinite(null) and isFinite('') are true, since both convert to 0. That makes it easy to accept empty input by mistake when validating forms.
It's still useful when you deliberately want to accept numeric strings. When the value should already be a number, Number.isFinite() is stricter and usually the better choice.
Syntax
isFinite(value)Parameters
- valueThe value to test. It is converted to a number first.
Return Value
true if the value is a finite number after conversion, otherwise false.
Example
Browser Support
The following information will show you the current browser support for the isFinite() function. Hover over a browser icon to see the version that first introduced support for this function.
Desktop





Tablets & Mobile





