728x90
SMALL
#javascript
#isFinite()
isFinite()
isFinite() is a function that checks if a parameter is finite.
Grammar
isFinite( value )
value: Enter the value to check.
Returns true if the number is finite, false if the number is infinite or not a number.
example
- Returns true since 123.123 is a finite number.
- Infinity returns false because it is an infinite number.
- Returns false because Not a Number is a character.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JavaScript</title>
<style>
body {
font-family: Consolas, monospace;
font-size: 16px;
line-height: 1.6;
}
</style>
</head>
<body>
<script>
var a = 123.123;
var b = Infinity;
var c = 'Not a Number';
document.write( '<p>123.123 : ' + isFinite( a ) + '</p>' );
document.write( '<p>Infinity : ' + isFinite( b ) + '</p>' );
document.write( '<p>Not a Number : ' + isFinite( c ) + '</p>' );
</script>
</body>
</html>
Reference
- The function to check if a parameter is a number isNaN.
728x90
LIST