Learn Basic OOP by Building a Shopping Cart - Step 9

Tell us what’s happening:

in destructuring the order is important,
so the order of object creation should be the same of the order of destructuring
but in the objective, the order is different.

Your code so far

  ({id,name,price,category}) => {}

doesn’t equal a correct code

  ({name,id,price,category}) => {}

is a correct code for this step…

Your browser information:

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

Challenge Information:

Learn Basic OOP by Building a Shopping Cart - Step 9

1 Like

The order for destructuring actually doesn’t matter here as much as you think it does. We’re accessing it by the name of the properties, rather than the type of the properties.

For this challenge, it seemed more convenient to put the order the properties were named. I do think with a bit better regex we can make it work regardless of order. For now, you can open up an issue on the Github.

Hope this helps a little bit.