Javascript Reference - JavaScript ceil() Method








The ceil() method rounds a number up to the nearest integer, and returns the result.

Browser Support

ceil() Yes Yes Yes Yes Yes

Syntax

Math.ceil(x);

Parameter Values

Parameter Description
x Required. The number to round up




Return Value

return a number after rounding up.

Example

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.