Missing before statement in #27


#1

I have a 'missing before statement' error in Intro to objects with this code, Can you get me unstuck? I tried to get some help from other posts on this lesson but I couldn't find the cure. Thanks.
// 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();
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++){

console.log(family[i].name + "aged" + family[i].age);
};


#2

Hey @codecoder69850,

You need to call family as an array, right? You need to add this:

var family = [];


#3

here is my code:
// 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();
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++) {
console.log(family[i].name);
}


#4

Thanks to both you guys/gals? I can't for the life of me figure out where I made my mistake. must have been a typo or punctuation error because pasting javaace's code worked. Getting the right answer is not nearly as satisfying as knowing why it's right but I do understand now why it works. Thanks for the help.

Mark