Build a Shopping Cart - Step 43

Tell us what’s happening:

What am I doing incorrectly? Please help. Thanks a lot!

Your code so far

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

/* file: styles.css */

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

 calculateTotal() {
  const subTotal = this.items.reduce((total, item) => {
    return total + item.price
  },0)
  return subTotal
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0

Challenge Information:

Build a Shopping Cart - Step 43

Hi there!

Implicity return just total plus item.price in the callback function.
Remember, Implicit return didn’t need the return keyword and callback function’s block {}.

Note: when you need to return one linear code statement within the callback function, it’s didn’t need return keyword and code blocks {}

1 Like