Home »
JavaScript
Number isNaN() Method with Example in JavaScript
JavaScript Number isNaN() Method: Here, we are going to learn about the isNaN() method in JavaScript with Example.
Submitted by IncludeHelp, on February 08, 2019
Number isNaN() Method
isNan() method is a Number method in JavaScript, it is used to check whether a number is a valid number or not. It returns true if the number is "Not-a-Value".
Syntax
Number.isNaN(number);
Example
Input: 10
Output: true
Input: 10.23
Output: true
Input: 0/0
Output: false
Example - Use of Number isNaN() Method
<html>
<head>
<title>JavaScipt Example</title>
</head>
<body>
<script>
document.write(Number.isNaN(NaN) + "<br>");
document.write(Number.isNaN(0/0) + "<br>");
document.write(Number.isNaN(10) + "<br>");
document.write(Number.isNaN(10.23) + "<br>");
document.write(Number.isNaN(0) + "<br>");
document.write(Number.isNaN('') + "<br>");
document.write(Number.isNaN('Hello') + "<br>");
document.write(Number.isNaN('08/02/2019') + "<br>");
</script>
</body>
</html>
Output
true
true
false
false
false
false
false
false
JavaScript Number Object Methods »