0
Why is output 0.3 instead of 0.30?
let sum = 0.1+0.2; console.log(+sum.toFixed(2));
3 Answers
+ 9
IlyaVerem
This is because 0.1+0.2 is 0.30000000000000004 and by fixed it in 2 fraction value it will return 0.30
https://www.sololearn.com/discuss/1093191/?ref=app
https://www.sololearn.com/discuss/1137574/?ref=app
https://www.sololearn.com/discuss/1288636/?ref=app
https://www.sololearn.com/discuss/374762/?ref=app
+ 1
Remove the Plus (+)
0
I know that it happened because of plus. I'm wondering why)