运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 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 true NaN? " + Number.isNaN(true) + "<br>" + "Is true NaN? " + Number.isNaN(false) + "<br>" + "Is undefined NaN? " + Number.isNaN(undefined) + "<br>" + "Is 'NaN' NaN? " + Number.isNaN('NaN') + "<br>" + "Is NaN NaN? " + Number.isNaN(NaN); document.getElementById("demo").innerHTML = result; </script> </body> </html>