Listing everybody help please


#1


4. Listing Everybody


Oops, try again. It looks like your list function didn't console.log "Bob Jones". Did you remember to call list(); after creating it?


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(i = 0; i < contacts.length; i++){
        printPerson[contacts[i]]
        }
}
list();


#2

You should have contacts[i] in () not brackets


#3

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