Build a Shopping Cart - Step 10

Tell us what’s happening:

I don’t know what to do here. How do I destructure the properties of dessert instance.

Your code so far

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

/* file: styles.css */

/* file: script.js */
// User Editable Region
  (Dessert = {id,name, price, category}) => {}
// 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/152.0.0.0 Safari/537.36

Challenge Information:

Build a Shopping Cart - Step 10

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-shopping-cart/63ec36f6133df7160be3ec66.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @Emmysifire,

Given the starting code, forEach will look for an item in products, which in this case is an object. You do not need to use assignment when you destructure this object.

products.forEach(

  () => {}

);

Hope that helps.

why is this not passing correctly?

addItem(id, products) {

  const product = products.find((item) => {return item.id === id});    

  }

};

Please create a new topic for the Step you are on…and use the “Help” button to send the code and a link to the challenge step. Thank you.