What happens if I don't call the function 'list'?Does the code work or is there an error?


#1

var friends = {};
friends.bill = {
firstName : 'Bill',
lastName : 'Pereira',
number : 554444,
address : ['9','Park Street','Vasai','401202'],

};
friends.steve = {
    firstName : 'Steve',
    lastName : 'Fernandes',
    number : 99937473,
    address : ['202/2','Cupertino','Naigaon','401303'],

    };
    var list = function(obj)
    {
       for(var prop in obj){
           console.log(prop);

           } 
        };
        var search = function(name)
        {
            for(var prop in friends){
                if(friends[prop].firstName=== name){
                    console.log(friends[prop]);
                    return friends[prop];
                    }
                }
            };

//list(friends);
search("Steve");


#2

The search function will still work, you just won't get the output that the list function would give.