7: List 'em all trouble


#1

I've been moving along nicely until this point.
I've been double checking my syntax and breaking down the steps for my second function but its:
1. Not printing anything to console
2.Coming back with " Your search function doesn't print any information about steve".

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

var friends = {
    bill: {
        firstName:"Bill",
        lastName:"Gates",
        number: "555-555",
        address: ['One Microsoft Way','Wilmington', 'Vermont', '10202']
    },
    steve: {
        firstName:"Steve",
        lastName:"Jobs",
        number:"666-666",
        address: ['Two Macintosh Drive', 'Miami', 'Florida', '10909']
    }
};

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

#2

that is because your for loop only has the value of bill and not steve


#3

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