Why is output 0.3 instead of 0.30? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is output 0.3 instead of 0.30?

let sum = 0.1+0.2; console.log(+sum.toFixed(2));

18th Nov 2019, 11:29 AM
IlyaVerem
IlyaVerem - avatar
3 Answers
18th Nov 2019, 11:46 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
Remove the Plus (+)
18th Nov 2019, 11:45 AM
Jônatas Araripe
Jônatas Araripe - avatar
0
I know that it happened because of plus. I'm wondering why)
18th Nov 2019, 12:43 PM
IlyaVerem
IlyaVerem - avatar