Search for a friend, prints steve twice


My code prints steve twice for some reason? I can't correct it no matter what I change.

ar friends = 
        firstName: "Bill",
        lastName: "Gates",
        number: "503-234-6744",
        address: ['microsoft way'],
        lastName: "Jobs",
        number: "324-525-6642",
        address: ['Apple Street'],
 var list = function(friends)
     var search = function(name)
       for(var key in friends)
           if(friends[key].firstName === name) 
               return friends[key];


You've got a function inside a function and you aren't calling either of them - your code doesn't do any printing. Alternatively that you've created a function that is still in memory that is being called by codecademy but that you've removed from your code.

I'm guessing you used to have code that did some printing, and that the environment (codecademy) is doing the second printing.

So my suggestion here is that you fix your code so that your function behaves like it should, and then add a line at the bottom of your code that prints out "My program has finished, any further printing isn't done by my code" or something like that. If more gets printed after that, then you know it's not your code.