Build a Shopping Cart - Step 51

Tell us what’s happening:

why this cartTaxes.textContent=$${this.tax.toFixed(2)};
cartTotal.textContent=$${this.total.toFixed(2)}; does not work?
how can solve this problem

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

  calculateTotal() {
    const subTotal = this.items.reduce((total, item) => total + item.price, 0);
    const tax = this.calculateTaxes(subTotal);
    this.total = subTotal + tax;
    cartSubTotal.textContent = `$${subTotal.toFixed(2)}`;
 cartTaxes.textContent=`$${this.tax.toFixed(2)}`;
 cartTotal.textContent=`$${this.total.toFixed(2)}`;
  };

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Shopping Cart - Step 51

hello and welcome to fcc forum :slight_smile:

  • why are you using “this” keyword for “tax”? try without it

happ coding :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.