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