My result is not what I expected


#1

var friends = new Object();

friends.steve = {
firstName: "Steve",
lastName: "Jamie",
number: "233-5433-122",
address: ['One Microsoft Way','Redmond','WA','98052']};

friends.bill = {
firstName: "Bill",
lastName: "McCarthy",
number: "231-2233-121",
address: ['233 Kensington Road','Liverpool','UK','12052']
};

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

list(friends);

This code outputs steve, bill, steve, bill.
Shouldn't it just output steve, bill?


#2

Your ran "friends" thus everybody was printed


#3

Yes, but why twice? I got steve,bill,steve,bill instead of just steve,bill


#4

@nikosio,

In some sections of this course, the course-checker Display's data
this you could then identify by placing two EXTRA code-line's:
console.log( "== My End ==" );
console.log( "== All that is displayed now, is the course-checker ==" );


#5

Thanks for your reply. I believe this must be it, the course-checker. Later on lesson "Building an Address Book", part "Displaying People" I noticed they mentioned, "Don't worry if your output appears twice - we're just double checking your code!"