4. Listing everybody. i dont see whats wrong


#1



https://www.codecademy.com/courses/building-an-address-book/0/4?curriculum_id=506324b3a7dffd00020bf661#


TypeError: person is undefined


var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
};

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"
};

var contacts = [bob, mary];

function printPerson(person) {
    console.log(person.firstName + " " + person.lastName);
}

var list = function()
{
    var contactsLength = contacts;
};
    for (i=0;i<contacts.length;i++);
{
    printPerson(contacts[i]);
}

list();


#2

you list function is a bit off a mess:

var list = function()
{
    var contactsLength = contacts;
}; // end of function, bit early don't you think?
    for (i=0;i<contacts.length;i++); // auch, semi-colon here means the 
    // for loop will never run
{
    printPerson(contacts[i]);
}
// close your function here

#3

oh god yes.. i feel kinda dumb now.
thanks a lot. i keep forgetting things whenever i dont go online for a couple of days.