Why does {} get printed after 'bill' and 'steve'?


#1



https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/6?curriculum_id=506324b3a7dffd00020bf661#


My console prints out this:

bill
steve
{}

I don't think it should print the curly braces, right?


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

var friends = {    
    bill: {
        firstName: "Bill",
        lastName: "Gates",
        number: "456416516658",
        address: ['One Microsoft Way','Redmond','WA','98052']
    },    
     steve: {
        firstName: "Steve",
        lastName: "Jobs",
        number: "123645455",
        address: ['Apple Mountain','LA','CA','10101']
    }    
};

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


#6

Why are you creating var friends = Object() and then overriding it with var friends = { ... };

Maybe remove these lines:

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

#7

Ahhh, thank you!
I guess I didn't quite understand one of the first steps, now I see my mistake