Building an adress book, listing everybody


#1

Hey, guys!
I got an error

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

undefind underfined
undefind 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.length;
    for(var i = 0; i < contactsLength; i++);
    {
        printPerson([i]);
    }
};

list();


#2

Hi!

Kindly remove semi-colon at the close of the parenthesis here, it's acting as a suppressor.

This line too,

you should be indexing contacts like this:

printPerson(contacts[i]);

#3

Thank you so much. The error corrected.


#4

You're welcome. Glad I could help! :smile:


#5

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