12. Loops and Arrays II



Having a bit of trouble. The log displays "I know someone called undefined". I get this message:

"Oops, try again. Your code should have printed 'I know someone called linz', 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 = ["linz", "steve", "heather", "roger", "kylie"];
for (var i = 0; i < names.length; i ++);
    console.log("I know someone called " + names[i]);


Be sure to write the correct syntax as required in a for statement. Note the differences below:

for (var i = 0; i < names.length; i++) {
    // code

There is no semi-colon permitted where you have one, and the code block { } is required.