12.Loops and arrrays II


#1


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

Oops, try again. Your code should have printed 'I know someone called Anette', 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 have tried many times to fix my code, but I can´t make it work.  Can anyone explain what I am doing wrong? 
I have tried to refresh the page. There is a space between "called" 
and the "+" sign. 

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


#2

console.log("I know someone called" + names[i]); // here need a space between called and names[i]

so just do

called "

#3

Thank you. Seriously, that doesn´ make sence too me, but whatever, it worked. Again, thanks!


#4

You printed a different string, correcting the string makes it print the same as was expected


#5

I have the same problem but I don´t be able to fix it. What the ■■■■ is with this code?

var netflix = ["Friends","Stranger things","Sense8","Ru Pauls Drag Race"];

for (var i=0; i < netflix.length , i++) {

console.log("My favourite show is " + netflix[i]);

}


#6

Hello Pypro87520,

Your code looks great - the error was coming from the missing semi colon on each bit in your "for" loop - you have a coma instead.

var netflix = ["Friends","Stranger things","Sense8","Ru Pauls Drag Race"];

for (var i=0; i < netflix.length ; i++) {

console.log("My favourite show is " + netflix[i]);

}


#7

Thank you so much!!! . It was impossible find the mistake. I was mad!!! :smile:


#8

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