Loop the loop



"Oops, try again. It looks like the object at index 0 was not created with the Person constructor"

Checked the forums several times on this excercise/issue, still unable to see what the issue is. Have tried changing i < family.length to i <4 as suggested on most of the forum answers, still not working. Help would be greatly appreciated!

function Person(name,age) {
    this.name = name;
    this.age = age;

var family = newArray();
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 < 4; i++) {


var family = newArray();

you want to create a new Array() which requires a space between the words (so you have new keyword and array object)


for (var i = 0; i < 4; i++) instead of 4, type family.length


oh just saw you tried it


:open_mouth: I new it'd be something as simple as a space! Thanks so much, that was driving me crazy!


no problem, i would then go back to family.length (like @finjii suggest), this way, your code can easily handle more or less Person members


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.