27. help,pls


Help, anyone tell me what did wrong, pls?
Thank you,

SyntaxError: Unexpected token )

Replace this line with your 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++, i < family.length) {


Make sure you have semicolons in your for loop and not commas to separate the parts of that loop.


Yeah, you r right!
but there are still something wrong in this code.


Is it still showing the same error message?


nope, we fixed it but it unable to log the name:

Oops, try again. Make sure to log to the console the name of each object


Maybe take a look at your for loop. Syntax-wise, a Javascript for loop basically looks like this:

for (starting point; ending point; increment/decrement) {
    //random code

You may have your for loop statement order wrong.


yeah, it's work, thank you for remind me.


No problem! Happy coding :slight_smile:


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