'Loops and arrays II' What am i doing wrong?


#1

My Javascript code:
var names = ["Rebecca","Sarah","Hannah","Felix","Marzia"];

for(var i = 0; i < names.length; i++)
{
console.log("i know someone called" + " " + names[i] + ".")
}
The 'Error':
"Oops, try again. Your code should have printed 'I know someone called Rebecca', 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!"
What it prints:
I know someone called Rebecca.
I know someone called Sarah.
I know someone called Hannah.
I know someone called Felix.
I know someone called Marzia.

Can someone please tell me what's wrong?
Its driving me crazy!! :rage:


#2

Don't kick yourself too hard.

get rid of this:

+ "."

at the end of your console.log statement.


#3

I would also suggest you include the space within the same string instead of separating it and concatenating it:

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

And place a semi-colon at the end of each statement, for standard coding practice.


#4

oh my gosh
facepalm for myself
Thanks so much!