Loops and Arrays II


#1

I'm having trouble with submitting this. I don't know what's wrong with my code. Please have a look. Thanks.

var names = ["Billy", "Mike", "Bobby", "Tony", "David"];

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


#2

Never mind. I figured it out. Thanks anyways!


#3

What was the issue, @xgee_whiz? Because I'm having the exact same issue and from what I see, my formatting is the same as yours. I'm still stuck on it..


#4

Hey @smondaca, I think what I did here was said "i < names.length" instead of "names.length < 5"

If you think about it, names.length is currently the number of variables the array is holding which is 5. So "5 < 5" wouldn't really work in this case.