What is wrong with my code?



Exercise Loop the Loop (27)

I keep getting the error message "Oops, try again. There was a problem with your syntax."

Please help me find the flaw!

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

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

var family[0] = new person("alice", 40);
var family[1] = new person("bob", 42);
var family[2] = new person("michelle", 8);
var family[3] = new person("timmy", 6);
// loop through our new array
for (i = 0; i< 4; i++) {


One thing I noticed (probably not going to solve the overall problem) You are missing a semicolon after your console.log statement.


I just figured it out actually.

I was declaring the array components as variables, which I shouldn't have been doing.

Thank you for the help!


No problem :slight_smile: glad that you were able to figure it out :slight_smile: