Strange error for Loop the loop


Loop the loop

Hi, for some reason, every time I try to run my code, it gives me the error message below. I've tried resetting the code, and yet it still does it. It looks correct to me, but obviously, could be wrong

We're running a test below to make sure your code works.

TypeError: Cannot read property 'name' of undefined

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

// Now we can make an array of people
family = new Array();

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

// loop through our new array
for(var i = 0; i <= family.length; i++){


Should be < alone or =<


@treeno, this line:

family[0] = Person("alice",40);

you should create new person (new instance):

family[0] = new Person("alice",40);

which means you need the new keyword. Same for all the others


That's great thanks!