7. search for a friend


#1

var friends={
bill: {
firstName: 'bill',
lastName: 'what',
number: 'wow',
address: ['One Microsoft Way', 'Redmond', 'WA', '98052']
},
steve: {
firstName: 'steve',
lastName: 'soso',
number: '555',
address: ['One Microsoft Way', 'Redmond', 'WA', '98052']
}
};
var list = function(friends){
for(var hoho in friends){
console.log(hoho);
}};
var search = function(name){
for(var key in friends){
if(friends[key].firstName === name)
{console.log(friends[key]);
return friends[key];}
}};

search('bill')

I cant find why my code is not working ...;;;


#2

@cloudsolver71069,

You will have to change the firstName properties
as "Steve' and "Bill"