#6 - (gotta) List em all


#1

Oops, try again. Did you create a function called list?
Yes, Yes I did.

friends={};
friends.bill = new Object();
friends.steve = new Object();
friends.bill.firstName = "Bill"
friends.steve.firstName = "Steve"
friends.bill.lastName = "Gates"
friends.steve.lastName = "Jobs"
friends.bill.number = 123456
friends.steve.number = 654321
friends.bill.address = ['Micro$haft','keksville']
friends.steve.address = ['Fapple','keksville']


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

};

};

It just seems to be printing out the last array I have stored.
Evidently there is some kind of glaring error, but in this context I cannot work it out.

The data seems to be formatted correctly, I'm assuming the list function is broken in some way.
I have stumbled my way though most of the tutorials, some of it I understand; most of it I do not.


#2
function list (friends,key) {
    for (var key in friends){
     console.log(friends[key])
    };

};

This seems to work better, however the tutorial prompt is stating:

Oops, try again. It looks like your list function isn't printing the right output.
Seems to be outputting everything to me, that being said, I don't really understand the point of the exercise.

Unrelated, is there a course planned for assembly, or is this site intended for www related stuff.


#3

I guess I cheated then. I wrote code matching all the conditions, I just ignored the parameter and used the object instead.

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