Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
35
rated 0 times [  38] [ 3]  / answers: 1 / hits: 80632  / 9 Years ago, fri, october 30, 2015, 12:00:00

How will i round margin_total to 3 decimal places?



margin_total = margin_total + parseFloat(marginObj.value);
document.getElementById('margin_total').value = margin_total;

More From » javascript

 Answers
10

Use num.toFixed(d) to convert a number into the String representation of that number in base 10 with d digits after the decimal point, in this case,



margin_total.toFixed(3);

[#64562] Tuesday, October 27, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bryonk

Total Points: 161
Total Questions: 116
Total Answers: 107

Location: Albania
Member since Sun, Nov 22, 2020
4 Years ago
bryonk questions
;