English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Math.ceil()The method returns the smallest integer greater than or equal to the given floating-point number.
If the passed parameter is an integer, the value will remain unchanged.
Because ceil() is a static method of Math, you always use it asMath.ceil()It is not used as a method of the Math object created.
Math.ceil(x)
Math.ceil(3.14); // 4 Math.ceil(.)95);// 1 Math.ceil(5); // 5 Math.ceil(-18);// -18 Math.ceil(-0.72); // 0Test and See‹/›
All browsers fully support the Math.ceil() method:
Method | |||||
Math.ceil() | Yes | Yes | Yes | Yes | Yes |
Parameter | Description |
---|---|
x | Number |
Return Value: | The smallest integer greater than or equal to the given number |
---|---|
JavaScript Version: | ECMAScript 1 |