Untitled

Anonymous
javascript
02/13/2026 4:38 AM
524 B
10
Indexable
function round2(x) {
    return Math.round(x * 100) / 100;
}

var totalAmounts = [];
var rate = TaxRate;

for (var i = 0; i < Subtotal.length; i++) {
    var sub = Subtotal[i];
    var tax = round2(sub * rate);
    totalAmounts.push(round2(sub + tax));
}

var taxAmount = totalAmounts.length > 0 ? round2(Subtotal[0] * rate) : 0;

({
    TotalAmount: totalAmounts,
    TaxAmount: taxAmount
});
Editor is loading...
Leave a Comment