Contact List- List' em all!


I passed the exercise. but I want an explanation of what is going on. Whenever I declare the function list() and I make it loop through each of the object properties...... Why does it automatically print bill and steve when I press submit. I would think that I must call the function ( for example list() ) before it actually console.log anything. Please help

var friends = {
    bill: {
        number: 813-224-3844,
        address: ["343 Hoken Street","Miami","FL"]
    steve: {
        firstName: "Steve",
        lastName: "Jefferson",
        number: 2,
        address: ["123 Main boulevard","Tampa","FL"]
var list = function(thing){
    for(var thing in friends){


var list = function(thing){ //Thing should be friends, so the computer knows what you're talking about
    for(var thing in friends){ //Thing should be key
        console.log(thing); //Thing should be key

Hope this helps.
[EDIT, Misread your post, disregard this]


okay chesswithsean,

why should the parameter be friends? I passed the exercise with the parameter being friends, horse, thing, bro it did not matter. I don't get how the function is called since we don't even have to call it and on the editor it will list bill and steve automatically.
and does it matter if is says key or thing right after var I noticed that if I put key or thing it still passed the exercise?


Like I said, I misread your post. I don't understand either.


Okay I understand that your question is regarding the console printing things even though you didn't tell it to? I think that if you had a typical compiler/IDE for JavaScript, that this wouldn't happen, but even though I don't personally know why it happens, I believe that it has something to do with the lessons correctness test. I think that it prints the things that it is checking because they have specific code to run and test your function as well as your "contact list".


Ok thanks kyleaw. I figured that it was something weird.


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