27.Loop the loop


#1


https://www.codecademy.com/en/courses/spencer-sandbox/4/2?curriculum_id=506324b3a7dffd00020bf661#


Hi, I can't seem to find the error in the whatsoever. Pls help!!
It says: "Oops, try again. It looks like you have an error in your code. Here's the message: TypeError: Cannot read property 'name' of undefined"


// Our Person constructor
var 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 <= 4; i++) {
    console.log(family[i].name);
};


#2

you don't have a family[4] so you want values lesser then (<4) not lesser or equal then 4 (<= 4) because then 4 is also included, but you don't have this


#3

Now I got it. Thank you for the reply.


#4