I dont know where is the problem


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") {
return friends.steve
else {
console.log("didnt find a name");


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
- do not properly understand FOR-in-loop
please read


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


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