6/8it asks "did I create a func called search"? [edit]


#1

var friends = {};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "(400) 222-2222",
address: ["222 bert st","Seattle","12324"]
}
friends.steve = {
firstName: "Steve",
lastName: "Jobs",
number: "(300) 111-1111",
address: ["111 Turd ave","San Francisco","12345"]
}
var list = function(object) {
for (var key in object) {
console.log(key);
}
var search = function(friends) {
for(var key in friends){
if(friends[key].firstName === name){
console.log(friends[key]);
return(friends[key]);
}
}
}

};

list(friends);


#2

The search function is embedded in the list function, for starters. It is not visible to the outside. Move the last brace up to just above var search = ....

Also, the search function should take a parameter, name, not the object. This function accesses the friends object as a global.