7/8 Oops, try again. It looks like your search function doesn't return contact information for Steve


#1

Not sure what I am doing wrong.

var friends = new Object();

friends.bill={};
friends.steve={};

friends.bill.firstName =["Bill"];
friends.bill.lastName=["Gates"];
friends.bill.number=["111-111-1111"];
friends.bill.address=['One time','One place','One state','One zip'];

friends.steve.firstName=["Steve"];
friends.steve.lastName=["Jobs"];
friends.steve.number=["222-222-2222"];
friends.steve.address=['Two time','Two place','Two state','Two zip'];

var list = function(friends){
for(var key in friends){
console.log(firstName);
}
}

var search = function(name){
for(var key in friends){
if(friends[key].firstName===name){
console.log(friends[key]);
return friends[key];
}
}
};


#2

As you defined the
friends.steve.firstName property-key
to have an asscociated array Value of
["Steve"]

you might want to change your search-function
into

var search = function(name){
    for(var key in friends){
        if(friends[key].firstName[0]===name){
             console.log(friends[key]);
             return friends[key];
        }
    }
};

#3

@themulkeyway for your list function:

var list = function(friends){
for(var key in friends){
console.log(firstName);
}
}

change the console.log command to log key rather than firstName.