Arrays and Objects in JS


I made an array with 3 elements as asked, but I get a syntax error, and I am not sure what it is. I kept the code the same, just added an array.

var list = [1,2,3];

for(val i=1; val<51; val++1);


Your for loop should be

for (var i; i < list.length; i++){

This will iterate over every item in your list and print it.
(Unless i am misunderstanding what your goal is)


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