Standard built-ins

Math.ceil()

Try the free JavaScript compiler

Smallest integer not less than the input; rounds toward positive infinity. Converts x to Number; BigInt conversion throws TypeError.

Formal Syntax & Structure

javascript syntaxjavascript
Math.ceil(x)

Parameters & Attributes

NameTypeDescription
xnumberNumber input or value coercible to Number.

Return Value

number

Result of the numerical operation, possibly NaN.

Working Example

Example Snippetjavascript
console.log(Math.ceil(-2.1));
JavaScript Reference