Update article.md

This commit is contained in:
Lavrentiy Rubtsov 2022-04-19 01:47:49 +06:00 committed by GitHub
parent 291b5c05b9
commit ee1daf7664
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -246,7 +246,7 @@ Can we work around the problem? Sure, the most reliable method is to round the r
```js run
let sum = 0.1 + 0.2;
alert( sum.toFixed(2) ); // 0.30
alert( sum.toFixed(2) ); // "0.30"
```
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: