Calculates the tax amount for a given subtotal and tax rate.
The pre-tax amount.
The tax rate as a percentage (e.g., 8.25 for 8.25%).
The tax amount, rounded to 2 decimal places.
const tax = calculateTax(100, 8.25);console.log(tax); // Output: 8.25 Copy
const tax = calculateTax(100, 8.25);console.log(tax); // Output: 8.25
Calculates the tax amount for a given subtotal and tax rate.