7. Search for friend


#1

Help, i finished this code :slightly_smiling:

var friends = new Object();
friends.bill = {
    firstName: "bill",
    lastName: "Jackson",
    number: "555-989-498-12",
    address: ['murica','LA']
    };
friends.steve = {
    firstName:  "steve",
    lastName: "jobs",
    number: "558-326-989-00",
    address: ['murica','LO']
    };
friends.simo = {
    firstName: "simo",
    lastName: "mojtahid",
    number: "536-9409-18",
    address: ['Morocco','OJ']
};
var list = function(friends) {
    for (var key in friends) {
        console.log(key);
    }
}
var search = function(name) {
    for(var key in friends) {
        if (friends[key].firstname === name) {
            console.log(friends[key]);
            return friend[key];
        }
    }
}
list(friends);
search("steve");

This is output :

bill
steve
simo

Im getting this error though : Oops, try again. It looks like your search function doesn't return contact information for Steve.


#2

@devninja48662,

-1
The course is expecting
the firstName's to be "Steve" and "Bill"
-2

Have a close look at firstName in your search function

firstname