AI

Now let's do some math! JavaScript can handle calculations for you. Use * for multiplication, + for addition, and Math.round() for rounding.

Your Task:

  • Create a variable subtotal that multiplies price by quantity
  • Create a variable tax that is 10% of the subtotal (multiply by 0.1)
  • Create a variable total that adds subtotal and tax
  • Create a variable roundedTotal using Math.round(total * 100) / 100 to keep 2 decimal places
TypeScript Solution
Loading...

Submit your code to see test results