I have 2 strings that have a 0 and a 16,63 as follows:
var diferencia = "0";
var estalviPotencia = "16,63";
If I put an alert to see its value with two decimals I obtain:
alert(parseFloat(diferencia).toFixed(2)) -- returns 0,00
alert(parseFloat(estalviPotencia).toFixed(2)) -- returns 16,63
But if I actually sum them and then get the value I get:
alert((parseFloat(diferencia) + parseFloat(estalviPotencia)).toFixed(2)); -- returns 16,00
I can't see the error and why I am obtaining that number...
Edit por possible duplicate:
I am NOT saying that the decimals are wrong as said on that answer (which asks why there so MANY decimals but why I am NOT obtaining any decimals at all.