We made a friend


#1

Hi, the exercise says that you have to write a function that prints the names of each entry in your object "friends", so you have to loop through that object with the for-in loop. Each entry in this object "friends" is also an object.

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

Look that I use "friend" instead of "key". You can use any name you want there. Also I use "friends" instead of "object", you have to put the name of the object you want to loop through there.

I'm sorry if my english is not perfect, it is not my native language.


It tells me it's wrong but I don't think it is
#2

you should just log friend to the console, all there information, not just the first name


#3

Hi, I'm new to this forum. You splited my reply into a new topic but I wasn't asking for help, I was replying to the other topic trying to help the other member.


#4

given your code contained a flaw original, i thought you also needed help.


#5

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