Math.ceil()

Math.ceil() rounds a number up to the nearest integer:

   Math.ceil(4.4);  // returns 5

HTML file: Displayed by browser:
<body>
<p>Math.ceil() rounds a number up to its nearest integer:<p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
    document.getElementById("demo").innerHTML =
    Math.ceil(4.4);
}
</script>
</body>

Math.ceil() rounds a number up to its nearest integer:


BackTable of ContentsNext