Contact List - List'em All!


My code logs excess information when I run it.

can someone help explain why?

var friends = {} ;
    friends.bill  = {
        firstName: "Bill",
        lastName: "Squire",
        number: "(408)111-2222",
        address: ['101 Code Way','San Jose','CA']};
    friends.shane = {
        firstName: "Shane",
        lastName: "Kistner",
        number: "(408)222-3333",
        address: ['123 Shane Way','San Jose','CA']};
    friends.pat = {
        firstName: "Pat",
        lastName: "Moroney",
        number: "(858)222-1111",
        address: ['321 Gay Ave','Brooklyn','NY']};
    friends.steve = {
        firstName: "Steve",
        lastName: "Guy",
        number: "(408)555-4321",
        address: ['9098 Somewhere Blvd','Los Gatos','CA']

var list = function (object) {
    for (var enumerable in object) {

var search = function(name) {
    for (var enumerable in friends) {
        if(friends[enumerable].firstName === name){
            return friends[enumerable];



When you find a match you're logging the entire 'friend' to the console. That includes all of their properties.

When you submit this exercise, the codecademy magic testing machine tries your function with a few different inputs to see how it responds which is why it logs so many outputs (2 Steve's, a Bill and a Steve).

Can you find a way to explicitly log each of your properties using your above 'list' function? You may need to adjust the console.log statement within it.


I am stumped.

I did run this same code in node & get 1 output. Which was nice.
But now I want to find out how to explicitly log each property.


Currently your list function logs the property names of a provided object. Try to get it to log 'property propertyValue' each iteration.

Recall that you can access the object's property values with the syntax obj[prop].


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