12. Loops and Arrays


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-NhsaT/2/4?curriculum_id=506324b3a7dffd00020bf661#

When I use this code I get this error message:

Oops, try again. Your code should have printed 'I know someone called Jessica', 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!

Please help I don't know what I am doing wrong

var names = ["Jessica" , "Cassidy", "Grace", "Selina", "Denny"];

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


#2

@bellzjay,
You will have to use the i variable
so use

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

#3

I just changed that, for some reason I mix "i" and "1" up lol. I did that but I get this error message:

Your code should have printed 'I know someone called Jessica', 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!

And this is my code:

var names = ["Jessica" , "Cassidy", "Grace", "Selina", "Denny"];

for (i = 0; i < name.length; i++ )

{

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

};

Nvm I fixed it, I needed to add an "s" in names.length


#4