Kindly check the code below and let me know what is wrong.I am getting an error?


#1

// Our Person constructor
function Person(name, age) {
this.name;
this.age;
};
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 i = 0; i < family.length; i++) {
console.log(family[i].name);
};

ERROR: It looks like your Person constructor does not properly save the first argument as the person's name


#2

@anushree27,
You will have to change the Person object class constructor

`
this.name = name;
this.age = age;


#3

oh yeah ! I forgot to write that. Thanks a lot :slightly_smiling::grinning: