I dont know where is the problem


#1

i've been stuck today all day trying to find what did i do wrong someone please help !!


var friends = {};
    friends.bill = {
        firstName: "Bill",
        lastName: "Popi",
        number: "071-851-150",
        address: ["New York", "Hell's Kitchen", "98052"]
        };
    friends.steve = {
        firstName: "Steve",
        lastName: "Selaki",
        number: "071-759-960",
        address : ["England", "Manchester", "12345"]
        };
    friends.paulo = {
        firstName: "Paulo",
        lastName: "Santos",
        number: "888-555-5432",
        address: ['somecountry','somecity','AK','90210']
    };
    
    
var list = function (friends)  {
    for(var firstName in friends) {console.log(firsName);}
  };

var search = function(name) {
for(var firstName in friends) {
if (friends.steve.firstName === "steve") {
console.log(friends.steve)
return friends.steve
}
else {
console.log("didnt find a name");
        }
    }
};


#2

friends.steve.firstName will be "Steve".....


The purpose of the search function,
you giving a name
and the search will give you the =contact= information corresponding to that name


As it seems you
- do not properly understand function usage of parameter and argument
please read
https://discuss.codecademy.com/t/6-dont-repeat-yourself-d-r-y/45616
- do not properly understand FOR-in-loop
please read
https://discuss.codecademy.com/t/6-list-em-all-really-confusing/30738/4


#3

I see you have a typo here if that helps. I think it should be {console.log(firstName);}


#4

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