7. Search for a friend (Steve not showing up)


#1

Hello,

Been stuck on this one for a couple of days, was wondering if you could help.

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

Error: Does not return contact information for Steve

var friends = {
  bill: {
      firstName: "Bill",
      lastName: "Gates",
      number: "555-555-555",
      address: ['One Beaudy','Montreal','Canada','h3l3e4']
      },
  steve: {
      firsName: "Steve",
      lastName: "Jobs",
      number: "666-666-6666",
      address: ['Two Christie Road','Martinez','CA', '90210']
      },
};

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

Help please!


#2

When you search, are you searching for "Steve", or "steve"? Be sure to search the proper name, not the property name.


#3

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