Latest web development tutorials
 

JavaScript Number isFinite() Method

< JavaScript Number Reference

Example

Check whether a value is a finite number:

Number.isFinite(123) //true
Number.isFinite(-1.23) //true
Number.isFinite(5-2) //true
Number.isFinite(0) //true
Number.isFinite('123') //false
Number.isFinite('Hello') //false
Number.isFinite('2005/12/12') //false
Number.isFinite(Infinity) //false
Number.isFinite(-Infinity) //false
Number.isFinite(0 / 0) //false
Try it Yourself »

Definition and Usage

The Number.isFinite() method determines whether a value is a finite number.

This method returns true if the value is of the type Number, and equates to a finite number. Otherwise it returns false.

Number.isFinite() is different from the global isFinite() function. The global isFinite() function converts the tested value to a Number, then tests it.

Number.isFinite() does not convert the values to a Number, and will not return true for any value that is not of the type Number.


Browser Support

Method
Number.isFinite() 19 12.0 16 9 22

Syntax

Number.isFinite(value)

Parameter Values

Parameter Description
value Required. The value to be tested

Technical Details

Return Value: A Boolean. Returns true if the value is a finite Number, otherwise it returns false
JavaScript Version: ECMAScript 6

< JavaScript Number Reference