HELP! List 'em all! is not working!


<Look to the right of this box. That is how your post will look to Archive of QA for this lesson everyone else.>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
List 'em all!

<In what way does your code behave incorrectly? Include ALL error messages.>
The error message says ‘Opps, try again. Did you create a function called list?’ Can anyone help? and by the way, I am only 12 so please no complicated words because I have seen some on other discussions. Thanks


Replace this line with your code.
var friends = {
bill: {
firstName: ‘Bill’,
lastName: ‘Gates’,
number: ‘01243567890’,
address: [‘ABC Close, London, BN9 7PN’]
var friends = {
steve: {
firstName: ‘Steve’,
lastName: ‘Lank’,
number: ‘01234567890’,
address: [‘DEF Close, London, BN9 7NP’]

var list = function (friends) {
for (var bill in friends) {

<do not remove the three backticks above>


You are looking for the first name here, so instead of var bill it should read var firstName…

var list = function(friends)
for (var firstName in friends) {

In your for loop, you are printing the firstName using the console.log function but your not calling for it in your for loop.

Also, if your creating a new object called “friends”, then you dont need to create it twice.

var friends = new Object();

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

I’m still learning myself, so there might be a better way to even improve on my code, but with my code, I created the object “Friends” once and then used dot notation to create 2 more objects for each friend.


Thank you! I have been trying to find the error for like half an hour non stop! I think I was trying to print everything cause it is like midnight XD @erfwerm


LOL! Its all good man. 2am knows all my secrets. The later it gets, the more I tend to overlook things like brackets and ; and such. Im glad i could help. Happy coding!


Lol you 2 :smile: @erfwerm


Thanks for the help. I happened to need this. Cheers!