Lesson 7 what's wrong with my code?


#1

var friends = {
bill: {
firstName:"Bill",
lastName:"Chill",
number:"(13)284664",
address:['one microsoft way','redwood','WA','98987']
},
steve:{
firstName:"Steve",
lastName:"Jobs",
number:120900080909,
address:['apple way','white wood','CA','82138']
}
};
var list = function(friends){
for(var names in friends){
names[friends];
console.log(names);
};
};
var search = function(friends){
for(var firstName in friends){
friends[firstName];
if(friends[firstName].firstName===name){
console.log(friend[firstName]);
return friends[firstName];
}
};
};:confounded:
thanks for any help


#2

HI this function

var search = function(friends){
    for(var firstName in friends){
    friends[firstName];
        if(friends[firstName].firstName===name){
            console.log(friend[firstName]);
            return friends[firstName];
        }
    };
};

the argument of that function should be name instead of friends then this line

console.log(friend[firstName]);

you wrote friend instead of friends .


#3

Great!! thank you ! :slight_smile: