JS Built-ins
← Math88 / 215
Mathceilbeginner

Math.ceil(4.9) Equals 5

πŸ“– Usage Example
// Round up to the nearest integer
Math.ceil(4.2)   // β†’ 5
Math.ceil(-4.2)  // β†’ -4

Use Math.ceil() when you need to round a number up to the next whole integer.

Math.ceil(x)

Regardless of how close a number is to the next integer below, Math.ceil() always rounds up. Math.ceil(4.9) returns 5.

Challenge: Verify that Math.ceil(4.9) rounds up to 5.

πŸ’‘ Hints (2)
  • β€’ ceil does not round to the nearest integer; it always rounds up
  • β€’ Both 4.1 and 4.9 ceil to 5