Search for a friend


#1

var friends=new Object();

friends.bill=new Object();
friends.bill.firstName="Bill";
friends.bill.lastName="Gate";
friends.bill.number="3453445";
friends.bill.address=["34","avenue","washing","340013"];

friends.steve=new Object();
friends.steve.firstName="Steve";
friends.steve.lastName="Job";
friends.steve.number="23322";
friends.steve.address=["57","avenue","China","pekin","433333"];
var list=function(friends){
for(var key in object){
console.log(friends[key].firstName);
}
};

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

hi ,i could not pass the lesson:
it told me :Oops, try again. Did you create a function called search?

why ?i already created the var search=function(name)why it noticed me as this ?
thanks


#2

A post was merged into an existing topic: Search for a friend


#3