7. Search for a friend, need help


#1



https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/7?curriculum_id=506324b3a7dffd00020bf661#


The error message reads, "It looks like your search function doesn't return contact information for Steve." I do not really understand the for/in loops, so I'm assuming that's where the error is coming from. Thanks for the help in advance.


var friends= new Object();
    friends.bill= new Object(); 
        friends.bill.firstName= "Bill";
        friends.bill.lastName= "Gates";
        friends.bill.number= "(309) 555-5555";
        friends.bill.address= ['Three Microsoft Way', 'Redmond', 'WA', '98052'];

     friends.steve= new Object(); 
        friends.steve.firsName= "Steve";
        friends.steve.lastName= "Jobs";
        friends.steve.number= "(308) 444-4444";
        friends.steve.address= ['One Apple Way', 'Silicon Valley', 'CA', '81553'];
     friends.joey= new Object();
        friends.joey.firstName= "Joey";
        friends.joey.lastName= "Krug";
        friends.joey.number= "(309) 368 4365"
        friends.joey.address= ['Prairie St.', 'Knoxville', 'IL', '61448'];
var list = function(friends) {
    for (var list in friends) {
    console.log(list);
}
}
var search= function(name) {
    for (var search in friends) {
        if (friends[search].firstName===name) {
        console.log(friends[search]);
        return friends[search];
}
}
};
list(friends);
search("Steve");


#2

@kelrkrug,

Have a close look at

firsName


#3

I can't believe I missed that. I guess I was more focused on the for/in loop section. Thanks a million, @leonhard.wettengmx.n