Contact List (6/8) function list is not working


#1

I wrote the function list but it's not working:

var list = function(friends) {
for (var prop in friends) {
console.log(prop);
}
}

Can you help me?


#2

Thank you I found the mistake.


#3

Can you write down where your mistake was? Thanks!


#4

It was not on the function. I forgot the comma after a property of the object.
Here is all the solution:

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

var list = function(obj) {
for(var prop in obj) {
console.log(prop);
}
};

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");