Can anyone please tell that what is wrong with this code?


#1

var friends = {};
friends.bill = {
firstName: "Bill",
lastName: "Gates",
number: "202-3667788",
address: ['One Microsoft Way','Redmond','WA','98052']
};
friends.steve = {
firstName: "Steve",
lastName: "Jobs",
number: "202-3557788",
address: ['One Apple Way', 'Silicon Valley', 'USA', '98053']
};
friends.jalaj = {
firstName: "Jalaj",
lastName: "Arya",
number: "202-3557799",
address: ['A-21', 'Talwandi', 'Kota', '324010']
};
var list = function(friends)
{
for(var bill in friends)
{
console.log(friends[bill]);
}
}


#2

In this lesson they ask you to output just the object names, you're outputting
You should console.log each object name not the properties/values of all the objects.

var list = function(friends)
{
for(var bill in friends)
{
console.log(friends[bill]); /* This is the part you have wrong */
}
}

Also there is no reason for you to call your variable "bill" in the for loop, it's just confusing. use a name such as x or key or something arbirtary.