运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Numbers</h1> <h2>The Number.isNaN() Method</h2> <p>Number.isNaN() returns true if the value is Number.NaN (Not a Number), otherwise false.</p> <p id="demo"></p> <script> let result = "Is 5-2 NaN? " + Number.isNaN(5-2) + "<br>" + "Is 0 NaN? " + Number.isNaN(0) + "<br>" + "Is 'Hello' NaN? " + Number.isNaN('Hello') + "<br>" + "Is '2005/12/12\ NaN? " + Number.isNaN('2005/12/12') + "<br>" + "Is ' ' NaN? " + Number.isNaN(''); document.getElementById("demo").innerHTML = result; </script> </body> </html>