English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript Math.ceil() Method

 JavaScript Math Object

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.

Syntax:

Math.ceil(x)
Math.ceil(3.14);   // 4
Math.ceil(.)95);// 1
Math.ceil(5);  // 5
Math.ceil(-18);// -18
Math.ceil(-0.72);  // 0
Test and See‹/›

Browser Compatibility

All browsers fully support the Math.ceil() method:

Method
Math.ceil()YesYesYesYesYes

Parameter Value

ParameterDescription
xNumber

Technical Details

Return Value:The smallest integer greater than or equal to the given number
JavaScript Version:ECMAScript 1

 JavaScript Math Object