Does not list it all


#1

Hello ,

for some reason my code doesnt print all of the parameters but only the 'firstName'... (Bill & Steve). where is the mistake in my code ? appreciate your help .thanks

var friends = new Object();

friends.bill = new Object();
friends.bill.firstName = "Bill",
friends.bill.lastName = "Bahb",
friends.bill.number = 555555555,
friends.bill.address = ["sesame street 1"];

friends.steve = new Object();
friends.steve.firstName = "Steve",
friends.steve.lastName = "Shmok",
friends.steve.number = 65465465,
friends.steve.address = ["helem street 11"];

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

#2

if you decide that your function should have a parameter (friends) you should also supply an argument on function call.

what is in listed? it contains the properties of friends. The properties of friends are bill and steve. (the objects bill and steve, not the first name)

What would you like to display and how do you think you can achieve this?


#3

Also, the instructions clearly state in step 3 of this exercise: "if you only have bill and steve as entries, list should just print out "bill" and "steve".)"


#4

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