JS Built-ins
← Math179 / 215
Mathroundbeginner

Math.round() β€” 0.1 rounds to 0

πŸ“– Usage Example
// Round to nearest integer (ties go up)
Math.round(4.5)   // β†’ 5
Math.round(4.4)   // β†’ 4

Use Math.round() to round a number to the nearest integer, with ties (.5) rounding up.

Math.round()

Returns the value of a number rounded to the nearest integer.

Challenge: Verify that Math.round(0.1) returns 0.

πŸ’‘ Hints (1)
  • β€’ 0.1 is closer to 0 than to 1, so it rounds down to 0