1var subTotal="12.1345";// can also be int, float, string
2var subTotalFormatted=parseFloat(subTotal).toFixed(2); //"12.13"
3
1function round(value, precision) {
2 var multiplier = Math.pow(10, precision || 0);
3 return Math.round(value * multiplier) / multiplier;
4}