7. Search for a friend


#1

I've been trying to figure out what's wrong with my search function and have been turning up nothing. So I tested it by taking the code from the completed project they give at the beginning. It still doesnt pass even though it prints the information. Is this lesson faulty?

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

list(friends);
search("steve");

#2

your code looks fine. I experienced a similar problem and iI fixed it saving my code and refreshing the page.


#3

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