Search for friend


#1

var search=function(name){
       for(var key in friends){
           if(friends[key].firstName===name){
               console.log(friends[key]);
               console.log(friends[key].number);
           return (friends[key].number);
           }
       }
   };
   may i know the mistake there it tells tour search function is not returning contact information of steve

#2

currently you only returns steve number, not all information about steve


#3

even i edit it to return(friends[key]) instead return(friends[key].number) it is same sceinario


#4

can i see your full code?


#5

thanks, but i got my mistake


#6

That is even better :slight_smile: Good for your debug skills :slight_smile:


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.