[SOLVED] Contact List: Lesson 6: Says I didn't create function called list. ITS THERE!


#1


SOLUTION: Codecademy really wants me to write 'friend**s**' instead of 'friend'. That was all! face palms face so badly

To keep it short, I am getting this error:

       [Oops, try again. Did you create a function called list? ]

I do not know how to work it. I tried using reference the given at the beginning of the topic. I have no luck.

Q: What is happening? How do I get through this?

Note: I know function is written incorrectly. I am aware, but I am unaware of how to get through.


https://www.codecademy.com/courses/javascript-beginner-en-3bmfN/0/6?curriculum_id=506324b3a7dffd00020bf661#


var friend = new Object ();
    friend.bill ={
        firstName: 'Bill',
        lastName: 'Anderson',
        number: '0000000000',
        address: ['Catalinas','Caguas','Pr']
        };
    
    friend.steve ={
        firstName: 'Steve',
        lastName: 'Anson',
        number: '0000000000',
        address: ['Miradero','Mayaguez','PR']
        };

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


#2

This is how mine looks, and the only difference is keywords and variables,

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

There should be no problem with your code, your for loop is perfect,


#3

Solved. In friend ---> friends


#4

Just gotten your problem! :grinning:

Change all the times you've type in friend to friends because in the beginning you needed an object called friends not friend. :grin:


#5

Omggg so silly ;_; ... i thought the world was ending xD. THANK YOU :'3 bandit sir mam sir person!


#6

not sure what's wrong here. Thank you for the help in advance!

my code:
var list = function(friends) {
for (var key in friends) {
console.log(key);
}
};

keep getting error in syntax: unexpected token...


#7

I need to see all your code preformatted using this button,

</>

#8

I'm sorry, but I don't know what you mean....>_<


#9

Post all the code from the exercise you are on not just the function. :grin:


#10

oh,,. it definitely will help A LOT if i post all the codes.. lol..
Thanks!!

var friends = {};

friends.danna = {
firstName: "hwang",
lastName: "danna",
number:"206-666-8888" ,
address : ['1111', 'main st', 'redmond', 'wa', '98004']
}
friends.bill = {
firstName: "bill",
lastName: "clinton",
number: "123-4444444",
address : ['2222', 'hot sunny ville', 'cali', '98008']
}
friends.steve = {
firstName: "steve",
lastName: "jobs",
number: "345=23445555",
address: ['33333', 'first st', 'rainyville', '98052']
}
};

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


#11

You have an additional closing bracket } after the

 address: ['33333', 'first st', 'rainyville', '98052']
}

friends.steve = {
firstName: "steve",
lastName: "jobs",
number: "345=23445555",
address: ['33333', 'first st', 'rainyville', '98052']
}
};

#12

Thank you, it worked now!!


#13

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