7. Search for a Friend not finding Steve



Can't get it to work.
Oops, try again. It looks like your search function doesn't return contact information for Steve.

var friends = {
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "(206) 555-5555",
        address: ["400", "computer", "drive"]
    steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "(408) 555-5555",
        address: ["800", "laptop", "road"]

var list = function(friends) {
    for (var key in friends) {

var search = function(name) {
    for (var key in friends) {
        if (friends[key].firstName === name) {
            return friends[key];
        } else {
            return("couldn't find them");


HI you don't need of the else statement in this case

else {
    return("couldn't find them");


Hello @mastercoates, it seems you have placed your semicolon in the wrong place. The semicolon should be placed at the end of the function declaration, not at the end of the if..else statement. Fix this and your code should work.


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