Objects I loop the loop


#1

hi, whats wrong with my code. (its printing the name, as it's supposed to) i get an error: Cannot read property 'name' of undefined. Thanks

function Person (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);

for(var q = 0; q <= family.length; q++){
console.log(family[q].name);
};


#2

will refer to an element that does not exist. We should write it as,

    q < family.length;

#3

thank you very much!