Why is output 0.3 instead of 0.30? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
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 Respuestas
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