Skip to content

Commit ee1daf7

Browse files
authored
Update article.md
1 parent 291b5c0 commit ee1daf7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

1-js/05-data-types/02-number/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Can we work around the problem? Sure, the most reliable method is to round the r
246246

247247
```js run
248248
let sum = 0.1 + 0.2;
249-
alert( sum.toFixed(2) ); // 0.30
249+
alert( sum.toFixed(2) ); // "0.30"
250250
```
251251

252252
Please note that `toFixed` always returns a string. It ensures that it has 2 digits after the decimal point. That's actually convenient if we have an e-shopping and need to show `$0.30`. For other cases, we can use the unary plus to coerce it into a number:

0 commit comments

Comments
 (0)