How will i round margin_total to 3 decimal places?
margin_total = margin_total + parseFloat(marginObj.value); document.getElementById('margin_total').value = margin_total;
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,
num.toFixed(d)
d
margin_total.toFixed(3);
2.1m questions
2.1m answers
60 comments
57.0k users