Easy Tutorial
❮ Dom Obj Legend Prop Style Cursor ❯

JavaScript ceil() Method

JavaScript Math Object

Example

Round a number upward to its nearest integer:

Output result:


Definition and Usage

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

If the argument is already an integer, the result is the same as the argument.

Note: The ceil() method executes an upward rounding operation. It returns the smallest integer greater than or equal to the function's parameter.


Browser Support

All major browsers support the ceil() method.


Syntax

Parameter Values

Parameter Description
x Required. Must be a numeric value.

Return Value

Type Description
Number The smallest integer greater than or equal to x.

Technical Details

| JavaScript Version: | 1.0 | | --- | --- |


More Examples

Example

In this example, we will apply the ceil() method to different numbers:

a, b, c, d, e, and f output result:


JavaScript Math Object

❮ Dom Obj Legend Prop Style Cursor ❯