Call me crazy, but shouldn't this be working? 12.6 List 'Em All


OK, so this is a strange one.... I have this code:

var friends = new Object();
friends.bill = new Object();
friends.bill.firstName = "Bill"
friends.bill.lastName = "Gates"
friends.bill.number = "(209)555-5555"
friends.bill.address = ['One Microsoft Way', 'Redmont']

friends.steve = new Object();
friends.steve.firstName = "Steve"
friends.steve.latName = "Jobs"
friends.steve.number = "(717) 676-5647"
friends.steve.address = ['Five Apple Streeet', 'Loganville']

var list = function (friends)

for(var friendsInfo in object)
console.log (friends)

However, I am told that I never made a function called list, but it is right here:

var list = function (friends)



This line is wiping out the function above it. The line may be removed.

Suggest using simple, generic variable names in a for statement. The iterator variable is technically scoped to the block inside the for statement (technically, not actually) so needn't describe anything more than its bare purpose.

var list = function (object) {
    for (var key in object) {

Is this making sense?


That worked. Thank you!