Why does this not work

Tell us what’s happening:

// running tests

myList

should be an array. The first elements in each of your sub-arrays should all be strings. The second elements in each of your sub-arrays should all be numbers. You should have at least 5 items in your list. // tests completed // console output TypeError: Cannot read property ‘2’ of undefined

Your code so far
var myList = [[“red bull”, 5][“yogurt”, 3][“nuts”, 2][“cigaretes”, 1][“fruit”, 5]];


var myList = [["red bull", 5]["yogurt", 3]["nuts", 2]["cigaretes", 1]["fruit", 5]];

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36.

Challenge: Shopping List

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/shopping-list

1 Like

Arrays must have commas between items.