Search for a friend


#1


whats wrong here ? :confused:


https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/7?curriculum_id=506324b3a7dffd00020bf661#


https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/7?curriculum_id=506324b3a7dffd00020bf661#


#2

var friends= {
    steve:{
        firstName: "Steve",
        lastName: "jobs",
        number: 01681193899 ,
        address: ['343',"west","kandapara","narsingdi"]
    },
    bill:{
        firstName: "Bill",
        lastName: "klinton",
        number: 01771111183 ,
        address: ['344',"west","kandapara","narsingdi"]
    },
    c:{
        firstName: "Cat",
        lastName: "walk",
        number: 01521207797,
        address: ['345',"west","kandapara","narsingdi"]
    }
};
var list=function(fristName){
  for(var fristName in friends){
      console.log(fristName);
  }
    
};
var search=function(name){
  for(var key in friends){
    if(friends[key].fristName===name)
    {
        console.log(friends[key]);    
        return friends[key];
    }
  }
};
search("steve");

#3

this line:

if(friends[key].fristName===name)

you misspelled firstName, for the rest the code is good


#4

thanks bro :yum: :blush: