Loops & arrays II


#1

hi all,

ive looked at other posts and as i can see that i cant find a relevant one. Can anyone see where i am going wrong in this code??

var names = ["Aaron", "Mario", "Matt", "James", "jayesh"];

for (var i = 0; i < names.length; i++); {
console.log("I know someone called "+ names[i]);
}


#2

this line:

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

the last semi-colon prevents the loop from executing properly. See semi-colons as full stops, they end a sentence. Same here, it prevents the loop from executing properly


#3

thank you, you are a legend.