âš ī¸ Warning âš ī¸ Deprecated Code! This video tutorial contains outdated code.
💡 If you wish to update it, any AI assistant will update the code for you in seconds.

JavaScript How to Calculate Tax Rates into Prices

Published : January 12, 2023   •   Last Edited : November 24, 2025   •   Author : Adam Khoury

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>