Math.ceil()

In this chapter you will learn:

  1. How to use Math.ceil()

ceiling method

The Math.ceil() method is the ceiling function. Math.ceil() rounds numbers up to the nearest integer value.

<!DOCTYPE html><!--from  j  a  va2s. c  o m-->
<html>
<head>
    <script type="text/javascript">
        document.writeln(Math.ceil(25.9)); //26 
        document.writeln(Math.ceil(25.5)); //26 
        document.writeln(Math.ceil(25.1)); //26 

    </script>
</head>
<body>
</body>
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. How to use Math.floor() method
Home » Javascript Tutorial » Math
Math Object
Math min() and max()
Math.ceil()
Math.floor()
Math.round()
Math.random