Listing Everybody....Not!


I looked in the forms to see if anyone else had this issue but didn’t come across it.
I did however see other issues people were having & when looking at their code for the list function none looked like mine.
I passed the lesson but didn’t have a console log of any kind & didn’t use contacts.length.
I made my code look like theirs with the suggested corrections to their code hoping to have something log on the console without success.
Is my code correct?
Was something supposed to log on the console?

![Screenshot (10)_LI|690x387](//


After getting to the next lesson the list function code was changed to what I assume is supposed to be the correct code. So I copied it & went back to try it - it logged but gave me the following
error message:

Oops, try again. Your code threw the following error when trying to call list(): TypeError: Cannot read property ‘length’ of undefined

This is the code the lesson had listed:

function list() {
var contactsLength = contacts.length;
for (var i = 0; i < contactsLength; i++) {
contacts = list();


I discovered the correct code!
My function call was the problem with the lesson’s correct code.
The correct call is simply list(contacts);
This call did not work with my original incorrect code.
I assume that my incorrect code enabling me to pass the lesson is a sign of a “bug”.
Just glad the correct code was revealed in a later lesson!


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