Skip to main content
Version: 3.27.2

Math.ceil()

The Math.ceil() function always rounds up and returns the smaller integer greater than or equal to a given number.

Syntax

Math.ceil(x)

Parameters

  • x
    • : A number.

Return value

The smallest integer greater than or equal to x. It's the same value as -Math.floor(-x).

Description

Because ceil() is a static method of Math, you always use it as Math.ceil(), rather than as a method of a Math object you created (Math is not a constructor).