Shopping List help pls

Continuing the discussion from freeCodeCamp Challenge Guide: Shopping List:

That does not work even as: var myList = [[“Chocolate Bar”, 15], [“Biscuit”, 20], [“Cake”, 25], [“Sweet”, 30], [“Drink”, 35]];:confused:

It is crazy!:rage: Gosh, I have no idea what to do!

If you need help with a challenge, can you please share your solution so far and tell us what problems you’re running into with it? (What tests are failing? What error messages are you getting? What is working differently than you expect it to? etc)

Ha ha, I know the answer now!

It is:

var myList = [
[‘Bread’, 56],
[‘Chips’, 97],
[‘Potatoes’, 123],
[‘Onions’, 78],

This works fine… try it out
var myList = [
new Array(“Chocolate Bar”, 15),
new Array(“Milky Bar”, 11),
new Array(“Coffee Bar”, 12),
new Array(“Cococola”, 13),
new Array(“Pepsi”, 14)

var myList = ;

var i;

for (i = 0; i < 5; i++) {

myList.push([“something”, 15]);


anyone tried to create a for loop for this.

1 Like