7. Search for a name


#1

I keep getting


error it looks like your search function doesnt return information for steve.


here is my code


var friends = {
bill: {
firstName: 'Bill',
lastName: 'Gates',
number: '(206) 555-5555',
address: ['One Microsoft Way','Redmond','WA','98052']
},
steve: {
firstName: 'Steve',
lastName: 'Jobs',
number: '(205) 555-5555',
address: ['Apple Bite Lane','Los Angeles','CA','87543']
}
};
var list = function(list) {
for(var key in friends) {
console.log(key);
};
}

var search = function(friends) {
for(var key in friends) {
if(friends[key].firstname === name) {
console.log(friends[key]);
return friends[key];
}
}
};
list(friends)
search("steve")



#2

@alexd999,

the FUNCTION talk

var myFunc = function( param1, param2) {
       //Begin of  anonymous FUNCTION-BODY
       //VARIABLE -myFunc- has an -anonymous function- assigned
       //this -anonymous function- has 2 PARAMETERS param1 and param2
       //param1 and param2 PARAMETERS are used 
       //as -local- VARIABLES throughout the FUNCTION-BODY

      console.log( param1 + " and " + param2 ) ;

      //End of anonymous FUNCTION-BODY
};

If you want to call/execute the anonymous function
you will have to add a pair of parentheses to the variable myFunc
like
myFunc();
As the anonymous function was defined
as having 2 parameters
you have to provide 2 arguments
in our case 2 string VALUES "Alena" and "Lauren"
like
myFunc("Alena","Lauren");

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


#3

I found it on my own
i wrote

it needs to be .firstName