W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>JavaScript 数学</h1> <p>Math.ceil() 将数字向上舍入到最接近的整数:</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>