4. Listing Everybody - debugging i guess


#1


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

so its pretty likely that im just being stupid since that happens often but up until this point i think my code has worked in the previous exercises so i think i get the gist and ive looked at other peoples code and cant seem to see the problem..
it says:
'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];

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

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

sorry if the prob is just, fundamental, and glaringly obvious.


#2

What is this line for, as you don't use contactsLength. (This is just a wasted effort, not an "ACTUAL" problem)

Here is the actual problem. Your command is telling the computer to log contacts[i] which would be bob or mary. It should be giving it to printPerson()


#3

nice, thanks, sorry i was very tired last night. always code when im half asleep its such a bad idea