JavaScript How to Calculate Tax Rates into Prices
Learn to calculate tax rates into prices using JavaScript.
<script>
let gstRate = 5;
let pstRate = 10;
let roomprice = 100;
let totalwithgst = roomprice * (1 + gstRate / 100);
let totalwithpst = roomprice * (1 + pstRate / 100);
let totalfixedgst = totalwithgst.toFixed(2);
let totalfixedpst = totalwithpst.toFixed(2);
alert( totalwithgst + " | " + totalwithpst );
alert( totalfixedgst + " | " + totalfixedpst );
</script>