Loops and arrays II error! Please help!


#1

Code seems fine, but it still gives me "Oops, try again.
Your code should have printed 'I know someone called " Error
Please help!

var names= [" Dandelion "," Ciri " ," Yennifer" ," Geralt "," Triss "];
for ( var i = 0 ; i < names.length ; i ++ )
{
console.log ("i know someone called" + names[i]);
    }

#2

I have the same problem. I think the code is right, but it's saying "Oops, try again..."

var names = ["Adria", "Pau", "Gemma", "Irene", "Lidia"];

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


#3

console.log ("i know someone called" + names[i]); Code academy is very picky. The problem is possibly the i isn't capitalized and definitely there needs to be a space after called. When in dout just copy and paste


#4

for (var i = 0; i < names.lenght; i ++) { You spelled length wrong. Other than that it looks good.


#5

Updated the code , pasted " I know someone called " still gives same error

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


#6

var names= ["Dandelion","Ciri" ,"Yennifer" ,"Geralt","Triss"];
for ( var i = 0 ; i < names.length ; i ++ )
{
console.log ("I know someone called " + names[i]);
}
This code works!
There were unwanted spaces after some of the names as well. You can see them in yours after Dandelion, Ciri, Geralt, and Triss.


#7

Thanks alot, it worked!


#8

OMG!! thanks! I didn't realize!


#9

This also worked for me.

Thank you for posting up a corrected code! I was able to see the differences in mine easily and able to make the changes!! Now I can do more Java =]