Loops and Arrays II Help. There is no way this is wrong!


#1

Can anyone help spot the problem, i've reading through all the forums for this section and still can't figure out what i'm doing wrong.
var names=["Ayan", "Nick", "Justin", "Steve", "Tom"];

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

The error msg reads:
Oops, try again. Your code should have printed 'I know someone called Ayan', 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!


#2

You need a space after "called". That is what the error is saying.


#3

I've tried that too still same msg
var names=["Ayan", "Nick", "Justin", "Steve", "Tom"];

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

unless i'm creating the space wrong?


#4

I'm new at programming so I'm not sure my solution will help you, but I see that your code shows name.length, shouldn't it be names.length? Maybe that fixes the error. Good luck!


#5

Omg yes! idk how i missed that. Thank you!