Contact List Issue


#1


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


I obtain this notification every time: "Oops, try again. Did you create a function called search?"


var friends = {};
friends.bill = 
{
    firstName: "Bill",
    lastName: "Nye the Science Guy",
    number: "420",
    address: ["sciencekidslane", "nerdsville"]
};
friends.steve = 
{
    firstName: "Steve",
    lastName: "from Minecraft",
    number: "666",
    address: ["blockroad", 555, "legoworld"]
};
friends.bob = 
{
    firstName: "Bob",
    lastName: "the Builder",
    number: "69",
    address: [232, false, 7438]
};

var list = function (friends)
{
    for(var firstName in friends)
    {
        console.log(firstName)
    }
};

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


#2

Too many semi colons. You only need one on the last closing bracket,


#3

console.log(firstName) <---need semicolon here


#4

I fixed everything that you said but I still obtain the same result: a notification implying that I have not created a function called search.


#5

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