运行 ❯
获取您的
自己
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Numbers</h1> <h2>The Number.isInteger() Method</h2> <p>Number.isInteger() returns true if the value is an integer of the datatype Number:</p> <p id="demo"></p> <p>Number.isInteger() is not supported in Internet Explorer 11 and earlier.</p> <script> let result = "Is 0 an integer? " + Number.isInteger(0) + "<br>" + "Is 0/0 an integer? " + Number.isInteger(0/0) + "<br>" + "Is 0.5 an integer? " + Number.isInteger(0.5) + "<br>" + "Is false an integer? " + Number.isInteger(false) + "<br>" + "Is Infinity an integer? " + Number.isInteger(Infinity) + "<br>" + "Is -Infinityo an integer? " + Number.isInteger(-Infinity) + "<br>" + "Is NaN an integer? " + Number.isInteger(NaN); document.getElementById("demo").innerHTML = result; </script> </body> </html>