7 : List 'em all


#1


excercise 7: list 'em all


Hi all, I dont know why I am getting this error report: "Oops, try again. It looks like your search function doesn't return contact information for Steve" Anyone?


var friends = {
   bill: {
       firstName: "Bill",
       lastName: "Danielsen",
       number: 065858,
       address: ["Koenstraat", "2251 EA", "Katwijk" ]
       },
   steve: {
         firstName: "Steve",
       lastName: "Jobs",
       number: 0655888,
       address: ["Kenstraat", "2251 EA", "Katwijk" ]
       }
       
       
};
var search = function (name) {
    for (var i in friends) {
        if ( friends[i].firstName == name )
     {
      console.log(friends[i]); 
      return console.log (friends[i]);
     }
    }
}
var list = function (friends) {

for (var print in friends )

    {
    console.log(print);
    }
};

search("Steve");


#2

when using return, you don't need to use console.log()


#3

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