im getting a little issue here. Im trying to do a simple math, but im forgetting something.
Here’s what:
var valorOriginal = 9.90;
var discount = Math.round(valorOriginal*12*0.25);
var anual = Math.round(valorOriginal*12)-discount;
alert(anual);
If you do this math on calc, it will give you 89.1, but im just getting 89 rounded. Whats wrong?
Thanks!
Math.round rounds up to the nearest integer value. So you will loose the decimal points. If you want the decimal, you are probably after toFixed().