Automatic functions. My functions function without being called


#1
var friends = {
    bill: {
        firstName:"Bill",
        lastName:"Gates",
        number:"(305) 451-2296",
        address: ["5727 Malcom Way", "Onslow", "NC", "34205"]},
    steve: {
        firstName:"Steve",
        lastName:"Jobs",
        number:"(823) 385-1846",
        address: ["3 Harris Street", "Banton", "OH", "38529"]},
    tricia: {
        firstName:"Katricia",
        lastName:"Moore",
        number:"(384) 386-1279",
        address: ["4629 Riley Way", "Canton", "NE", "28429"]}
    };
var list = function (search){
    for (var enter in friends)
        {console.log(enter)
        };
    };

This code give me an output of:

bill
steve
tricia

But I never called the function. Why is it doing that? :rage:


#2

sometimes codeacademy has test scripts that runs a user's submitted code and shows the output to console. It could be an output shown from the server if this console log is happening inside the exercise module