Code work but still an error


#1


#2

This is how you make the array of families:

//     Now we can make an array of people
    var family = new Array();
    `family[0] = new Person("alice", 40);`
    family[1] = new Person("bob", 42);
    family[2] = new Person("michelle", 8);
    // add the last family member, "timmy", who is 6 years old
    family[3] = new Person("timmy" , 6);

#3

Why would my code not work? I made a family array and I put the elements in a different way.


#4

Yea in a different way where javascript dosent support. Basically your way is different and unique, but javascript dosent support that way , meaning they didnt implement it in thier code therefore you cant use it.


#5

I think i see the mistake. The for loop maximum is i<=family.length. The array needs to have a maximum of family.length - 1 because it array starts in index 0


#6

it works now


#7

Nice good job!!! Have a healthy learning!


Intrested in Web Develpoment? Want to know more? Where to go next?This is the place for you!

Instrested in Game Development?Want to know more? Where to go next? This is the place for you!