JS Built-ins
← Math119 / 215
Mathfloorbeginner

Math.floor(-4.9) Equals -5

πŸ“– Usage Example
// Round down to the nearest integer
Math.floor(4.9)   // β†’ 4
Math.floor(-4.1)  // β†’ -5

Use Math.floor() when you need to round a number down to the nearest whole integer.

Math.floor(x)

Math.floor(-4.9) returns -5, rounding away from zero.

Challenge: Verify that Math.floor(-4.9) returns -5.

πŸ’‘ Hints (2)
  • β€’ Floor always moves toward -∞
  • β€’ -5 is "below" -4.9 on the number line, so it is the floor