7. Unexpected identifier/can't get it to say steve please help


#1

var friends = {};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "(206) 555-5555",
address: [ "One Microsoft Way", "Redmont", "WA", "585849"]
};
friends.steve = {
firstName:"Steve",
lastName:"Jobs",
number:"(402) 555-5555",
address:["1 Infinite loop","Cupertino","CA","95014"],

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


Unsure what is wrong with Syntax 7
#2

you have to add a closing brace (}) after this line and also remove the the trailing comma

address:["1 Infinite loop","Cupertino","CA","95014"],

your search function has some errors. this is it corrected with comments

var search = function(name) {
    //loop through friends
    for (var bill in friends) {
        //if the current friend's(i.e. bill)
        //firstName matches the name I have passed
        //then print it first and return it
        if(bill.firstName === name) {
            console.log(bill);
            return bill;
        }
    }
};