Basic JavaScript - Shopping List

Tell us what’s happening:
Hi, I think I am doing it right however for some reason it thinks it’s wrong.
Am I missing something?

Your code so far

const myList = [["Bread", 2]["Milk", 3]["Cereal", 4]["Chicken", 6]["Eggs", 9]];

Your browser information:

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

Challenge: Basic JavaScript - Shopping List

Link to the challenge:

There’s one detail, that’s causing the issue.

Notice how the sub-arrays, ie. ["Bread", 2], have separated each element. Then look at the outer array (the one that’s supposed to contain sub-arrays) and how elements are separated.

1 Like

Just add a comma “,” after each subarray and it will work!

const myList = [
["Bread", 2],
["Milk", 3],
["Cereal", 4],
["Chicken", 6],
["Eggs", 9]
];
1 Like

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