I'm being asked if I created a function called search


#1


Search For A Friend


I keepgetting an error message asking if I created a function called search


var friends = {};
friends.bill = {
  firstName: "Bill",
  lastName: "Gates",
  number: "(206) 555-5555",
  address: ['One Microsoft Way','Redmond','WA','98052']
};
friends.steve = {
  firstName: "Steve",
  lastName: "Jobs",
  number: "(408) 555-5555",
  address: ['1 Infinite Loop','Cupertino','CA','95014']
};

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


#2

you nest your search function in your list function, why? You also have a few unnecessary semi-colons


#3

That was it....Thanks..

LC


#4