12. for loop and array II


#1

Could you guys please tell me what is the error in this code?
/ Click on "Stuck? Get a hint!" if you get stuck!

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

#2

your code is absolutely fine.what's the error messagese?


#3

now I got the error... error is the double spacing between "know someone" ... Is spacing really mattter?


#4

in console.log,must be"I know someone called " + names[i],
not"I know someone called " + names[i]
you added a little space between "know" and "someone" but it shoud not have :slight_smile:
Reply if you can read this


#5

var names = ["Tomek","Kasia","Lucyfer","Unabomber","Starik"];
for (var i = 0; i < 5; i++)
{
console.log("I know someone called" + " " + names[i]);
}


#6

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