Codes for Assignment Search for a friend


#1

Hi. Do anybody know where I did wrong?
var friends={
bill:{
firstName:"Bill",
lastName:"Gates",
number:"6081112234",
address:['439 East Mall', 'Redland', 'CA','53703']},
steve:{
firstName:"Steve",
lastName:"Ventura",
number:"6085512234",
address:['439 East Mall', 'Redland', 'CA','53703']}
};
var list = function (name)
{
for (i in friends)
{
console.log (i)
}}
var search=function(friends){
for (var key in friends) {
if(friends[key].firstName===name) {
console.log(friends[number]);
return friends[number];
}
}
};


#2

@davistian125,

Look here for an explanation
object
function
for-in-loop
list-function
search-function
http://www.codecademy.com/forum_questions/545275fd8c1ccc8e3e000a23#comment-5457b12c9c4e9d87cb00003f