JavaScript Math.ceil()
Example
Math.ceil(1.4);
Try it Yourself »
let a = Math.ceil(0.60);
let b = Math.ceil(0.40);
let c = Math.ceil(5);
let d = Math.ceil(5.1);
let e = Math.ceil(-5.1);
let f = Math.ceil(-5.9);
Try it Yourself »
Definition and Usage
The Math.ceil()
method rounds a number rounded UP to the nearest integer.
JavaScript Rounding Functions
The Math.abs() MethodThe Math.ceil() Method
The Math.floor() Method
The Math.round() Method
The Math.fround() Method
The Math.trunc() Method
Syntax
Math.ceil(x)
Parameters
Parameter | Description |
x | Required. A number. |
Return Value
Type | Description |
Number | The nearest integer to the number rounding UP. |
Browser Support
Math.ceil()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |