6. List 'em all - list function prints out names twice


My code is below, the out put prints "bill steve bill steve" with each name on its own line in the console.

var friends = {
bill: {
firstName: "Bill",
lastName: "Bill_last_name",
number: 2348760967,
address: ["1 ■■■■ YOU WAY", "NOWHERE", "RANDOM"]
steve: {
firstName: "Steve",
lastName: "Steve_last_name",
number: 4531988716,
address: ["2 ■■■■ YOU WAY", "NOWHERE", "RANDOM"]

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



I pasted your exact code and it prints 'bill steve' only once. Do you still have this problem?


You neeed to delete list(friends) in the last line, then you have both name on time


Instead of list(friends), put list(friends.firstName); this should work


Do you know why you used 'x' as the key?


I don't' could you please explain?