ScanSkill

isFinite()

The isFinite() function determines whether the passed value is a finite number. It also converts to numbers from strings to check if the passed number is finite.

Syntax

isFinite(10000)

Example

let a = "200000";
console.log(isFinite(a)); // Prints: true

a = Infinity;
console.log(isFinite(a)); // Prints: false

a = "Hello";
console.log(isFinite(a)); // Prints: false

The isFinite() function firstly converts the passed in value to number if it fails at that point it returns false. If it passes that condition then, it checks if the value is finite to infinite and returns true or false based on that condition.