6/8 not picking up function called list?


#1

For some reason the editor won't accept this code.. is there something wrong? I've tried refreshing and I think my code is right? Can anyone help?

var friends = new Object();

friends.bill = new Object();
friends.steve = new Object();

var friends = {
bill: {
firstName: "Bill",
lastName: "Rogers",
number: "(01244) 356 431",
address: ["22 Delamere Drive, Great Sutton, Ellesmere Port"],
}
};

var friends = {
steve: {
firstName: "Steve",
lastName: "Jones",
number: "(0151) 339 2322",
address: ["30 Hopkinson Court, New Crane Street, Chester"],
}
};

var list = function (friends) {
for (var key in object) {
console.log[key];
}
};


#2

@devninja51539 -

At the bottom, you have:

console.log[key];

I think it's supposed to be:

console.log(key);


#3

I actually figured this out.. although you are correct, there was another mistake..

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

That's the right syntax. I had forgotten to put friends instead of object in the for.