File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
1-js/05-data-types/02-number Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ There are several built-in functions for rounding:
137137: Rounds up: `3.1` becomes `4`, and `-1.1` becomes `-1`.
138138
139139`Math.round`
140- : Rounds to the nearest integer: `3.1` becomes `3`, `3.6` becomes `4`, the middle case: `3.5` rounds up to `4` too .
140+ : Rounds to the nearest integer: `3.1` becomes `3`, `3.6` becomes `4`. In the middle cases `3.5` rounds up to `4`, and `-3.5` rounds up to `-3` .
141141
142142`Math.trunc` (not supported by Internet Explorer)
143143: Removes anything after the decimal point without rounding: `3.1` becomes `3`, `-1.1` becomes `-1`.
@@ -147,8 +147,10 @@ Here's the table to summarize the differences between them:
147147| | `Math.floor` | `Math.ceil` | `Math.round` | `Math.trunc` |
148148|---|---------|--------|---------|---------|
149149|`3.1`| `3` | `4` | `3` | `3` |
150+ |`3.5`| `3` | `4` | `4` | `3` |
150151|`3.6`| `3` | `4` | `4` | `3` |
151152|`-1.1`| `-2` | `-1` | `-1` | `-1` |
153+ |`-1.5`| `-2` | `-1` | `-1` | `-1` |
152154|`-1.6`| `-2` | `-1` | `-2` | `-1` |
153155
154156
You can’t perform that action at this time.
0 commit comments