1var subTotal="12.1345";// can also be int, float, string
2var subTotalFormatted=parseFloat(subTotal).toFixed(2); //"12.13"
3
1var number = 12.3456789;
2var rounded = Math.round( number * 10 ) / 10;
3// rounded is 12.3
1>>> parseFloat(0.9999999.toFixed(4));
21
3>>> parseFloat(0.0009999999.toFixed(4));
40.001
5>>> parseFloat(0.0000009999999.toFixed(4));
60
7