27/33 Code not logging to console


#1


I get the error message "Oops, try again. Make sure to log to the console the name of each object."
I'm not sure what I'm doing wrong (duh)

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


// 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(i=0,i < family.length; i++;){
    console.log(family[i].name);
}


#2

Found it!

What's a comma doing in the for loop?

Hope this solves your problem!


#3

Also you put a semicolon after your i++.

...And don't forget to "mark as solution" any post that fixes your problem. It helps other people with the same problem learn how to fix it.


#4

Thank you very much! :relaxed:


#5

You're very welcome :slight_smile:


#6

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