6/8 Accepts my code, but output doesn't match instructions! Help!


#1

Submitting below code is accepted, and prompts me to move on. However, output is the list of friends (as instructed) PLUS all info for the last friend (steve). How do I get output to be JUST list of friends (as instructed)?

Code below...

var friends = new Object();

friends.daniel = {
firstName: 'Daniel',
lastName: 'H',
number: '419-555-5555',
address: ["X Green Street", "San Francisco", "CA"]
};
friends.julia = {
firstName: 'Julia',
lastName: 'L',
number: "415-555-5555",
address: ["X Newport Road", "Portland", "ME"]
};
friends.bill = {
firstName: 'Bill',
lastName: 'Gates',
number: '206-555-5555',
address: ["1 MSFT Way", "Seattle", "WA"]
};
friends.steve = {
firstName: 'Steve',
lastName: 'Jobs',
number: '405-555-5555',
address: ["1 Infinite Loop", "Cupertino", "CA"]
};

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


#2

Call your list() function to see the output. The lesson checker will also run the function to test it, so expect additional output. You should not see any other output.

When we don't call the function ourselves, the command line interpreter responds with the last assignment, which is friends.steve. This can be ignored.


#3

Ah! That makes sense! Thanks so much.


#5