Search function doesn't return contact information for Steve


#1
var friends ={
bill: {
    firstName : "Bill",
    lastName : "mishra",
    number : "999",
    address: ['Noida', 'Bihar']
    },
steve: {
    firstName: "Steve",
    lastName: "chu",
    number: "888",
    address: ['Delhi', 'LA']
    }
};

list = function(fri){
    for(var prp in fri)
    console.log(prp);
}

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

#2

I use a bit of different syntax then what they say to use but here is what worked for me:

var friends = {};

friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: ['er','er']
};
friends.steve = {
firstName: "Steve",
lastName: "Gates",
number: "(206) 555-5555",
address: ['er','er']
};

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