I don't know whats wrong with my code. Please Help!


#1


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


Im not sure what's wrong with my code. Please help me!
Error messages:
"Oops, try again. Whoops--it looks like you looped past the end of the array!"
This is the result of the code:
I know someone called John
I know someone called Jake
I know someone called Bill
I know someone called PJ
I know someone called James
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined
I know someone called undefined

var names = ["John" , "Jake" , "Bill" , "PJ" , "James"];
// ^ Declare the array

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


#2

Hey there! A small typo, the array you define is called names, the array in your for-loop syntax is called name.


#3

Ok. Thanks it worked


#4

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