27. Loop the loop


#1

I get SyntaxError: missing ) after argument list.

// 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);
}

Can't find what I am missing. I think I'm going crazy!


#2

A lowly comma missing...

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

#3

hah thanks can't believe I missed that


#4

These kind of mistakes never get old. We all make them pretty much lifelong. Lots on our mind will do it.