Learn Basic OOP by Building a Shopping Cart - Step 19

Tell us what’s happening:

Hello

I had issues originally remembering what restructuring was, and did my own research. I have a better understanding of the concept, but I am not sure what I am doing wrong here. Any help is appreciated

Your code so far

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

  addItem(id, products) {
    const product = products.find((item) => item.id === id);
    const [, name, price, ] = product;
  }

// User Editable Region

Your browser information:

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

Challenge Information:

Learn Basic OOP by Building a Shopping Cart - Step 19

1 Like

HI @Sprigazalea !

Welcome to the forum!

Remember that product is an object

 {
    id: 1,
    name: "Vanilla Cupcakes (6 Pack)",
    price: 12.99,
    category: "Cupcake",
  },

you should not use array syntax here

once you fix the syntax, then the test will pass

2 Likes

Thank you so much! That indeed fixed it