Cant understand the error


#1



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


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


Replace this line with your code. 
var friends=new Object();
friends.bill=new Object();
      friends.bill.firstName= "Bill";
       friends.bill.lastName="Gates";
       friends.bill.number= "(206) 555-5555";
       friends.bill.address=["washington"];
friends.steve=new Object();
friends.steve.firstName= "Steve";
       friends.steve.lastName= "Perry";
       friends.steve.number= "(206) 655-6565";
        friends.steve.address=["london"];
        var list=function(friend){
            for(var place in friend){
                console.log(place);
                }
            };
            var search=function(name){
            for(var place in friends){
                if(friends[place].firstname===name){
                   console.log(friends[place]);
                   return friends[place];
                    }
                }
            };
            list(friends);
            search("steve");


#2

I am having the same error.
Here's my code
var friends=new Object();
friends.bill=new Object();
friends.steve=new Object();
friends.mark=new Object();
friends.bill.firstName="bill";
friends.steve.firstName="steve";
friends.mark.firstName="mark";
friends.bill.lastName="gates";
friends.steve.lastName="jobs";
friends.mark.lastName="Zuckerberg";
friends.bill.number=888;
friends.steve.number=999;
friends.mark.number=555;
friends.bill.address=["sad","sdg","pog"];
friends.steve.address=["saaaaaad","sdsdsdg","hrgpog"];
friends.mark.address=["srgread","sdeggg","pogda"];
var list=function(friends1)
{
for(var firstname in friends1)
{
console.log(friends1[firstname]);
}
};
list(friends.bill);
list(friends.steve);
list(friends.mark);
var search=function(name)
{
for(var x in friends)
{
if(friends[x].firstName===name)
{
console.log(friends[x]);
return friends[x];
}
}
};
search("steve");


#3

in your last if statement:

 if(friends[place].firstname===name){
                   console.log(friends[place]);
                   return friends[place];
                    }

You gotta change firstname to firstName. Remember? The second word is always capitalized.


#4

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