Merge pull request #2960 from Rnbsov/patch-26

add some emphasis
This commit is contained in:
Ilya Kantor 2022-05-03 23:50:47 +04:00 committed by GitHub
commit b60f9fc743
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 ```js run
let sum = 0.1 + 0.2; 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: 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: