Loop the loop


#1



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


Oops, try again. It looks like you have an error in your code. Here's the message: TypeError: Cannot read property 'name' of undefined

Hello my name is alice!and i am 40
Hello my name is bob!and i am 42
Hello my name is michelle!and i am 8
Hello my name is timmy!and i am 6


We're running a test below to make sure your code works.
Hello my name is alice!and i am 40Hello my name is bob!and i am 42Hello my name is michelle!and i am 8Hello my name is timmy!and i am 6
TypeError: Cannot read property 'name' of undefined


// Our Person constructor
Person = function(name, age) {
    this.name = name;
    this.age = age;
};
var family = new Array();
// Now we can make an array of people
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 <= family.length; i++) {
    console.log("Hello my name is " + family[i].name + "!" + "and i am " + family[i].age);
};


#3

Thank you, it works now.