It works, but it seems wrong



I really have no idea what is wrong with my code. It does exactly what it should. The function is there and has the correct name, but an error occurs.

I really hope you can help me.

Best regards!


Maybe there shouldn't be any arguments in function. Only ()


Why? The function only works when I pass the array-position with the help of a parameter to contacts[parameter].firstName.


I'm having the exact same problem, it's working, but I am getting an error asking if I created the function called printPerson. The only thing that I can think is that we have not written it exactly as the instructions have requested, however I cannot find the discrepancy.


This thread helped me solve the issue:


Sorry, but this thread discusses a completely different problem. I work with the correct parameter, the function does what it shlould. It also tried to make the function return the names and let the console log the function as described in the thread. Same problem.


It helped me find the way that the tutorial wants you to respond. I have found these to be finicky, even when you have done things correctly it will not let you move forward until you solve the problem exactly as they want you to.


If you're on step 3: Displaying People, the directions say "Define a function called printPerson that takes a parameter called person."

Therefore in order to pass, you need to use person as your parameter, rather than k. If it had said "Define a function called printPerson that takes a single parameter," without specifying what to use, then k would work.


Yes, I am on step 3. Thank you for the hint, but it still does not work. I tried every option with the parameter called "person", but it still responds with the same error.



I think maybe you're trying to put a little too much into printPerson? I had console.log(person.firstName + " " + person.lastName); and then passed contacts[0] in as the person parameter.


This actually works. Wow. Thanks!

But I don't get why I need to do it in that complicated way. We use functions to minimize the amount of work. "printPerson(0);" is way faster to use than "printPerson(contacts[0]);".


Might be something about bracket notation vs. dot notation. Someone with more experience than me... any thoughts?