isNaN-1

 

NaN stands for Not a Number, so isNaN function will tell whether the passed value is not a number OR number. This is how we can pass the value in isNaN function and get the output: isNaN(NaN) , isNaN(undefined) , isNaN(null) , isNaN(37) will result in true,true,false and false.

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <p>The isNaN() function returns true if the value is NaN (Not-a-Number), and false if not.</p> <button onclick="checkNumber()">Check the value</button> <p id="sample"></p> <script> function checkNumber() { var a = isNaN(NaN) + "<br>"; var b = isNaN(undefined) + "<br>"; var c = isNaN(null) + "<br>"; var d = isNaN(37) + "<br>"; numbers=a+b+c+d; document.getElementById("sample").innerHTML = numbers; } </script> </body> </html>
Output