List 'em All!


#1



Outputs Bill and Steve, but I get an error message, " It looks like your list function isn't printing the right output." Isn't this the result intended? Thanks for your help!


var friends = {
    bill: {
    firstName: "Bill",
    lastName: "Gates",
    number: "206-555-5555",
    address: ["1313 Mockingbird Lane", "Malibu", "CA", "90256"]
    },

    steve: {
    firstName: "Steve",
    lastName: "Jobs",
    number: "(314) 159-2524",
    address: ["666 Helle Street", "Hades", "ID", "43210"]
    }
};
  
var list = function (friends) {
    for (var key in friends) {
        console.log (friends[key].firstName);
    };
};


#2

Instead of what you have above all you need is console.log(key) :smiley:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.