Foundations

Group the Math

Group the Math

JavaScript follows operator precedence. Multiplication runs before addition and subtraction unless parentheses tell JavaScript to group a calculation first.

Your task: The subtotal should lose the discount first. Then tax should be added to the discounted amount. Create finalTotal and log it.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Group the Math

JavaScript follows operator precedence. Multiplication runs before addition and subtraction unless parentheses tell JavaScript to group a calculation first.

Your task: The subtotal should lose the discount first. Then tax should be added to the discounted amount. Create finalTotal and log it.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.