isNaN-3

 

new Date instances will returns the timestamp and it won't be NaN for any valid Date. So isNaN(new Date()) will return 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(new Date()) + "<br>"; var b = isNaN(new Date().toString()) + "<br>"; var c = isNaN("blabla") + "<br>"; numbers=a+b+c; document.getElementById("sample").innerHTML = numbers; } </script> </body> </html>
Output