Loops and array II


#1

var names ["tae" , "kwon" , "do" , "is" , "okay" ];
for (var i = 0; i < names.length ; i++ ) {
console.log("i know someone called " + " " + names[1]) ;
}

where wrong ?


#2

Assignment operator is missing.

change names[1] to names[i]


#3

var names = ["tae","kwon","do","is","okay"] ;
for (var i = 0; i < names.length ; i ++ ) {
console.log("i know someone called" + " " + names[i]);
}

still wrong


#4

What is the error message you're getting?


#5

This should work.

var names = ["tae", "kwon", "do", "is", "okay"];

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

#6

Try indenting that statement.


#7

sorry for late reply , i change the "i" to "I" then work thanks


#8

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