I am beginner in JS and this code
$('.brutto_amount').each(function (index, value) {
let amount = $(this).text().replace(' brutto / rok', '').replace('(', ''); console.log(amount);
if (discountType == 0) {
let newAmount = (amount - discountValue).toFixed(2);
if(newAmount < 0) newAmount = 1;
$(this).html(`${newAmount} brutto / rok `);
} else if (discountType == 1) {
let newAmount = (amount - ((parseInt(amount) * parseInt(discountValue)) / 100)).toFixed(2);
if(newAmount < 0) newAmount = 1;
$(this).html(`${newAmount} brutto / rok `);
}
});
works fine so far.
How can I subtract 23% VAT from the variable newAmount
and round it to 2 decimal places?