Question 12: can only get first item in array to print


#1

var names = ["Tom","Dick","Harry","Jane","Sally"] ;
for (var i = 0 ; i > names.length ; i ++ ) ;
{
console.log("I know someone called " + names[i]);
}

This code only prints: "I know someone called Tom". The loop does not appear to iterate.


#2

@rubyjumper49680,

for ([initialization]; [condition]; [final-expression]) {
   statement
}

You will have to change your condition
from your

 i > names.length

into

i < names.length