Intro to Objects 27. Loop the looop


#1

Everytime I run this code it says "Syntax Error: Missing ) after argument list." I"ve triple checked the code now and can't notice any missing parentheses. Please help. thanks!

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 Peron("timmy",6);

// loop through our new array
for(var i===0; i console.log(family[i].name);};


#2

missing something here
family[2]= new Person("michelle"8);


#3

check also the for loop. You haven't put the end condition, neither the i increment.It should be like this:

for(var i=0;i console.log(family[i].name);
}


#4

It seems the reply changes also my for code, so I suppose yours is good

However check also
family[3]=new Peron("timmy",6); (There is a missing s in Person)


#5

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