Error in for loop


Hello, I have done this Exercise but apparently it doesn't accept the space i gave it, i even tried copy pasting, nothing works.

var names = ["Name","name2", "name3","name4","name5"];

for(var i=0;i>5;i++)
    console.log("I know someone called " + names[i]);


look at your condition:


i is initialized as zero, so:


which is false, so the loop never runs. Maybe you need to change your loop condition


thanks, that fixed it.
however the error message displayed was confusing since it refers to the space in the string, not the for loop; hope that helps.


the only relevant part of the error message for you was:

Your code should have printed 'I know someone called Name', but didn't

don't fully rely on codecademy's error messages. Learn to debug and think critical on your own


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