运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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 4-2 an integer? " + Number.isInteger(4-2) + "<br>" + "Is 4/2 an integer? " + Number.isInteger(4/2) + "<br>" + "Is 5-2 an integer? " + Number.isInteger(5-2) + "<br>" + "Is 5/2 an integer? " + Number.isInteger(5/2); document.getElementById("demo").innerHTML = result; </script> </body> </html>