Looks like your search function doesn't return contact information


#1

The code still doesn't work, I get this error:

Oops, try again. It looks like your search function doesn't return contact information for Steve.

What am I doing wrong??

var friends = {
    bill: {firstName: 'Bill', lastName: 'Gates', number: '(206) 555-5555', address: ["Redmond"]},
    steve: {firstName: 'Steve', lastName: 'Jobs', number: '(420)-222-3333', address: ["Cuppertino"]},
};

var list = function (friends){
        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];
        }
    }
};

7. Search for a friend | Error
#2

friends is a global object that can be seen and accessed from inside this function. Use name for the parameter.


#3

Thanks for the help!


#4

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