27. Loop the Loop Help!


#1

Hello,
I can't seem to see what's wrong with the code below, from the previous excercises this seems right. When I click submit I get the message:

Oops, try again. It looks like you have an error in your code. Here's the message: TypeError: Person[("alice" , 40)] is not a constructor

& from the display screen:

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

TypeError: Person[("alice" , 40)] is not a constructor

Thanks

function Person (name, age){
    this.name = name;
    this.age = 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("Hello " + family[i].name);
}


#2

Hi you should add your person like that

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

with () instead of []


#3

Ahhhhhhhhhh, thank you Wizmarco.
When I submit I get what I'm supposed to get plus:

We're running a test below to make sure your code works.
Hello aliceHello bobHello michelleHello timmy

Is this okay to have or have I messed up somewhere?


#4

Yes, this part it's ok to have that