JS Built-ins
← Math120 / 215
Mathfloorbeginner

Math.floor(0.1) Equals 0

πŸ“– 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(0.1) returns 0.

Challenge: Verify that Math.floor(0.1) rounds down to 0.

πŸ’‘ Hints (2)
  • β€’ Any positive decimal less than 1 floors to 0
  • β€’ floor is commonly used to convert floats to integers