Home » JavaScript

Number isFinite() Method with Example in JavaScript

JavaScript Number isFinite() Method: Here, we are going to learn about the isFinite() method in JavaScript with Example.
Submitted by IncludeHelp, on February 08, 2019

Number isFinite() Method

isFinite() Method is a Number method in JavaScript, it is used to check whether a given number is a finite number or not.

It returns true if a given number is a finite number, otherwise, it returns false.

Syntax:

    Number.isFinit(number);

Here, number is a value/number to be checked.

Examples:

    Input: 10
    Output: true

    Input: 10.23
    Output: true

    Input: 'Hello'
    Output: false

Code:

<html>
<head>
<title>JavaScipt Example</title>
</head>
<body>
<script>		
	document.write(Number.isFinite(NaN) + "<br>");
	document.write(Number.isFinite(0/0) + "<br>");
	document.write(Number.isFinite(10) + "<br>");
	document.write(Number.isFinite(10.23) + "<br>");
	document.write(Number.isFinite(0) + "<br>");
	document.write(Number.isFinite('') + "<br>");
	document.write(Number.isFinite('Hello') + "<br>");
	document.write(Number.isFinite('08/02/2019') + "<br>");
	
</script>
</body>
</html>

Output

true
true
false
false
false
false
false
false




Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.