"Did you create a function called list?"


#1

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

It comes up with an error message saying "Oops, try again. Did you create a function called list?".

What the ■■■■ do I do????

I'm pretty sure list isn't meant to be blue...


#2

Can you post the rest of the code for a reference?


#3

Sure!
Note: I just deleted the addresses for my friends' sakes.

BTW, no idea what the last 'list' part means, so on a side note, I'll figure it out after I resolve this problem.


#4

Make sure the parameter for your function matches the second argument of your for in loop and that you're using your first argument in the console.log statement.


#5


I just tried that, I got the same message, "Oops, try again. Did you create a function called list?"


#6

Going by that screenshot, it does not match what I instructed.

var list = function(parameter){
for(var first argument in second argument){
console.log(first argument)
}
};

your screenshot indicates that your parameter matches your first argument, it should match your second, and you are not using your first argument in your console.log()

On a side note, you are calling your function right?
If you don't type list() on the last code line, your function will not run.


#7

Okay, so I got all the names.

Thanks, sorry I just can't read.


#8

I'm having the same issues. I think the instructions and the hints for this one are too unclear. At least add a hint to solve the problem, or a better error message since this is the first time the "for each" loop is used in this course. Because you are looping over "objects in objects" its pretty confusing which arguments goes where, and there's no IntelliSense yo guide the user.


#9

Yeah, I stuffed up the next part, so I went stuff it, and I'm starting again.


#10

I managed to fix it, but I have to admit the instructions are not clear. For someone just learning programming this might be pretty tricky. I'm new to JS, but have been coding for a few years in other languages.


#11

your script should look like this :

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

where x can be whatever you want. Don't quote me on that, but I realized if I put whatever I want instead of "X" like: water, boat, age, fish, and I have it to console.log(X), the script always display bill and steve.
I don't know if this makes sense to you or not, for me IT DOES NOT :)).
If someone is willing to explain this, I would really appreciate it. Thank you


#12