Have a math script function in a template
In this case it multiplies 2 numbers
5 x 186,71 = 933.55
Somehow the script gives me 933.550000000001
Need 933.55 back
Is there a easy way to “round” down to 2 decimals, now that the designer can’t do the math ?
How about the following:
var myNumber = 5 * 186.71;
results.html( myNumber.toFixed(2) );
You’ll probably want something like toFixed()
toFixed(x) work perfectly.
Thanks.