27.loop the loop


#1

// Our Person constructor
Person= function(name,age){
this.name= name;
this.age = age;
}

// Now we can make an array of people
var family = new Array();
family[0] = new Person("alice", 40);
family[1] = new Person("bob",42);
family[2] = new Person("michelle",8);
family[3] = new person("timmy",6);

// loop through our new array
for ( var i = 0; i console.log(family[i].name);
}

I dont understand why it says error?

does someone know?


#2

it copy it wrong, it is like this, the for loop:
for( var i = 0 ; iconsole.log(family[i].name);
}
I think there is a bug in the system


#3

Should probably look up syntax/examples of what you're trying to do before jumping to the conclusion that the bug is somewhere other than in your own code.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for