JS: isFinite

By Xah Lee. Date: . Last updated: .

isFinite is the value of the property key "isFinite" of the Global Object.

console.assert(globalThis["isFinite"] === isFinite);

Syntax

isFinite(arg)
  • First convert arg to a number.
  • Return true if arg is not any of NaN, Infinity, -Infinity, else false.

🟢 TIP: better is Number.isFinite .

console.assert(isFinite("3") === true);
console.assert(isFinite(3) === true);

console.assert(isFinite(NaN) === false);
console.assert(isFinite("NaN") === false);
console.assert(isFinite(Infinity) === false);
console.assert(isFinite(-Infinity) === false);

JavaScript. Special Literals