运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Math</h1> <h2>The Math.floor() Method</h2> <p>Math.floor() rounds a number DOWN to the nearest integer:</p> <p id="demo"></p> <script> let a = Math.floor(0.60); let b = Math.floor(0.40); let c = Math.floor(5); let d = Math.floor(5.1); let e = Math.floor(-5.1); let f = Math.floor(-5.9); document.getElementById("demo").innerHTML = a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e + "<br>" + f; </script> </body> </html>