7. Search for a friend - need help!


My code seems to half work. Whenever I go to submit it, I get the message: Oops, try again. It looks like your search function doesn't return contact information for Steve.

Can anyone help please?

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(555) 104-2984",
        address: ['Candy Street', 'New York', 'NY', '1102'],
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(111) 812-3334",
        address: ['Swirl Road', 'Brooklyn', 'NY', '2966'],
    var list = function(friends) {
        for (var firstName in friends) {
    var search = function(search) {
        for (var key in friends) {
            if(friends[key].firstName === name) {
            return friends[key];


in line

var search = function(search)

change it to

var search = function(name)

good luck , I am stuck here too and don't know why !!! :@


Just changing the parameter (search) to (name) for the search function should work. If it doesn't, at the bottom of the code put search("Steve"); to run your function and display the contact information.


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