Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

isFinite() — finiteness after numeric conversion

The global isFinite(value) function checks whether its argument becomes a finite Number after conversion. Unlike Number.isFinite(), it also accepts some non-number values through conversion, including "42" and null.

Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support

Syntax

isFinite(value)

isFinite(value) is a global ECMAScript function. It first converts its argument to Number using the ToNumber operation, then returns true if the result is finite. It returns false for NaN, Infinity, and -Infinity; both zeros and finite fractions produce true.

Conversion matters: "42" becomes 42, while "" and null become 0, so all these arguments produce true. undefined and the string "hello" become NaN and produce false. Calling isFinite() without an argument also produces false.

This is not a strict number-type check. To check whether a value is already a finite value of type Number, use Number.isFinite(value): it performs no conversion and returns false for "42", null, and every other non-Number value. Being finite does not imply being an integer or a safe integer.

Conversion can also throw: a Symbol or BigInt argument causes a TypeError instead of returning false. For objects, conversion can execute custom code and propagate an exception. The example compares both checks without using objects or values that throw.

Examples

const values = [42, "42", "", null, NaN, Infinity, undefined];
for (const value of values) {
  console.log(`${isFinite(value)} | ${Number.isFinite(value)}`);
}

Result

true | true
true | false
true | false
true | false
false | false
false | false
false | false

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources