7. search for a friend


#1

Please help. I am receiving error, there's a problem with my syntax.

var friends= {
bill :{
firstName:"Bill",
lastName : "Gates",
number : "555-555",
address :['One lake avenue','Redmont','WA','55567']
},
steve: {
firstName: "Steve",
lastName: "Rastafari",
number:"555-5555",
address: ['This','is','Steve's','AD','5569']
}
};
var list = function(friends) {
for (var key in friends) {
    console.log(key);
}
};
var search = function(name) {
    for( var key in friends){
        if(friends[key].firstName === name){
            console.log(friends[key]);
           
            return friends[key];
     
        }
    }
    };
search("Steve");

#2

Hi @gangadasi,

Hint: You have a string quotation mistake here:

address: ['This','is','Steve's','AD','5569']