Latest

recent

JavaScript isFinite() Function

Definition and Usage

The isFinite() function is used to check if a value is a finite number.

Syntax

isFinite(number)

Parameter Description
number Required. The value to be tested


Example

In this example we use isFinite() to check for finite numbers:

<script type="text/javascript">
document.write(isFinite(123)+ "<br />");
document.write(isFinite(-1.23)+ "<br />");
document.write(isFinite(5-2)+ "<br />");
document.write(isFinite(0)+ "<br />");
document.write(isFinite("Hello")+ "<br />");
document.write(isFinite("2005/12/12")+ "<br />");
</script>

The output of the code above will be:

true
true
true
true
false
false
JavaScript isFinite() Function Reviewed by 1000sourcecodes on 03:34 Rating: 5
Powered by Blogger.