JavaScript -Runde zu 2 Dezimalstellen
var subTotal="12.1345";// can also be int, float, string
var subTotalFormatted=parseFloat(subTotal).toFixed(2); //"12.13"
Grepper
var subTotal="12.1345";// can also be int, float, string
var subTotalFormatted=parseFloat(subTotal).toFixed(2); //"12.13"
var num = 125465.33695;
console.log(num.toFixed(2)) //125465.33
Math.round(num * 100) / 100
var num = 0,19784342446461994;
num = num.toFixed(5); // get total 5 number => 0,19784
num = num.toFixed(6); // get total 6 number => 0,197843
num = num.toFixed(7); // get total 7 number => 0,1978434
function round(value, precision) {
var multiplier = Math.pow(10, precision || 0);
return Math.round(value * multiplier) / multiplier;
}