Loop and Array 2


Loops and arrays II

Oops, try again. Your code should have printed 'I know someone called A', but didn't. Make sure to type the 'I know someone called ' part exactly right, and don't forget the space between that phrase and the name!

var names= ["A" , "B", "C", "D", "E"];
for (var i=0; i<4; i++);
    console.log("I know someone called " + names[i]);


for (var i=0; i<4; i++); // unnecessary semi-colon


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