27/33 Help


#1

I've tried a few different things and even passed the exercise somehow but the method didn't print out the names for each family member. Can anyone tell me what I've done wrong? Here's my code:

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

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

for(var i = 0; i < family.length; i = i + 1) {
    console.log("Family member name is " + family[i].name);

};

#2

You need to use the Person constructor to create a Person object.

family[0] = new Person("alice", 40);
family[1] = new Person("bob", 42);
family[2] = new Person("michelle", 8);
family[3] = new Person("timmy", 6);

#3

Of course :expressionless: Thank you!!!