File tree 1 file changed +3
-1
lines changed
1-js/05-data-types/02-number
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:
137
137
: Rounds up: ` 3.1` becomes ` 4` , and ` -1.1` becomes ` -1` .
138
138
139
139
` 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 ` .
141
141
142
142
` Math.trunc` (not supported by Internet Explorer)
143
143
: 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:
147
147
| | `Math.floor` | `Math.ceil` | `Math.round` | `Math.trunc` |
148
148
|---|---------|--------|---------|---------|
149
149
|`3.1`| `3` | `4` | `3` | `3` |
150
+ |`3.5`| `3` | `4` | `4` | `3` |
150
151
|`3.6`| `3` | `4` | `4` | `3` |
151
152
|`-1.1`| `-2` | `-1` | `-1` | `-1` |
153
+ |`-1.5`| `-2` | `-1` | `-1` | `-1` |
152
154
|`-1.6`| `-2` | `-1` | `-2` | `-1` |
153
155
154
156
You can’t perform that action at this time.
0 commit comments