Loops and arrays II - please help!


#1


Hello there,

I keep getting the message "Oops, try again. Your code should have printed 'I know someone called Marija', 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!". I'm not sure what the issue is. I even tried replacing the last line with this but it did work:

"I know someone called" + " " + names[i]

Otherwise, the code below does have a space after 'called'. Thank you!

M


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

var names = ["Marija", "Jenna", "Mariya", "Kelly", "Sarah"];

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


#2

your problem is:

length.names

you should change it to names.length


#3

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