HELP ME OUT GUYS, Its like No Way Out!


TypeError: Person[40] is not a constructor

// Our Person constructor
function Person(name,age){ = name;
this.age = age;
//var family=[];
var family = new Array();
// Now we can make an array of people
family[0] = new Person["alice",40];
family[1] = new Person["bob",42];
family[2] = new Person["michelle",8];
family[3] = new Person["timmy",6];

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



the error is how you are instantiating the Person object. The square brackets should be this () instead


Stupid Stupid me !!! Thank you :slight_smile:


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