The ceil()
method rounds a
number up to the nearest integer, and returns the result.
ceil() |
Yes | Yes | Yes | Yes | Yes |
Math.ceil(x);
Parameter | Description |
---|---|
x | Required. The number to round up |
return a number after rounding up.
The Math.ceil()
method is the ceiling function.
Math.ceil()
rounds numbers up to the nearest integer value.
console.log(Math.ceil(25.9)); //26
console.log(Math.ceil(25.5)); //26
console.log(Math.ceil(25.1)); //26
The code above generates the following result.