Others



JavaScript Math.ceil()


The Math.ceil(x) method used to returns the rounded up number to the nearest integer.

Syntax
Math.ceil(x)

Here, ceil() is a static method. Hence, we use it as Math.ceil().

Parameters
  • x - (Required).A number.
Return Value
  • Number - The value of x rounding UP to the nearest integer.
Example
console.log(Math.ceil(10.1));  //11
console.log(Math.ceil(10.3));  //11
console.log(Math.ceil(10.7));  //11
console.log(Math.ceil(-10.1)); //-10
console.log(Math.ceil(-10.9)); //-10
console.log(Math.ceil(-10.7)); //-10
Try it Yourself

JavaScript Math Functions