Use isFinite function to check if a number is finit in JavaScript
Description
The following code shows how to use isFinite function to check if a number is finit.
Example
if (isFinite(Number.NEGATIVE_INFINITY)) {
console.log("Number is finite.");
} else {/*w ww. ja v a 2 s .c om*/
console.log("Number is infinite.");
}
The code above generates the following result.