12.Loops and Arrays II Problem


I'm having trouble figuring out what I typed wrong. Could someone help me out? Thanks.


The problem is in your for loop:

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

You are saying while i is greater than the length, but it should be less than.
Change the > to <


Thank you @cadecodes for your solution!


Your welcome! Post again if you have any other questions!


thank you i made the same misstake but you forgot the var.
for( var i = 0; i > names.length; i++)


I don't need the var, as it is being used as a local variable. :slightly_smiling:


okay, of course you are right


tank you I must be blind. and need better glasses.


I changed the > Oops, try again. Your code should have printed 'I know someone called Yaina', 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!for the < and still geting the same answer.

I changed the > for the < and I getting the same message Oops.

// Click on "Stuck? Get a hint!" if you get stuck!

var names=["Yaina","Carlo","Pipito","John","George"];
for(var i=0; i< names.length;i++) {
console.log("I know someone called", " " + names[i]);
I know someone called Yaina
I know someone called Carlo
I know someone called Pipito
I know someone called John
I know someone called George


console.log("I know someone called", " " + names[i]);

in this line of code, instead of plus +, you used comma ,.