X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript isFinite() Function

Function Reference JavaScript Global Functions

Example

Check whether a number is a finite, legal number:

var a = isFinite(123) + "<br>";
var b = isFinite(-1.23) + "<br>";
var c = isFinite(5-2) + "<br>";
var d = isFinite(0) + "<br>";
var e = isFinite("Hello") + "<br>";
var f = isFinite("2005/12/12") + "<br>";

var res = a + b + c + d + e + f;

The result of res will be:

true
true
true
true
false
false

Try it yourself »


Definition and Usage

The isFinite() function determines whether a number is a finite, legal number.

This function returns false if the value is +infinity, -infinity, or NaN (Not-a-Number), otherwise it returns true.


Browser Support

Function
isFinite() Yes Yes Yes Yes Yes


Syntax

isFinite(value)

Parameter Values

Parameter Description
value Required. The value to be tested

Technical Details

Return Value: A Boolean. Returns false if the value is +infinity, -infinity, or NaN, otherwise it returns true.
JavaScript Version: 1.3


Function Reference JavaScript Global Functions

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook