0

I looked at the jsf.js file of Mojarra 2.2.8 and saw them using the module pattern. Something like this:

name.space = function() {

    var utilFunction = function utilFunction() {
        // some implementation
    };

    return {
        exposedFunction: function exposedFunction() {
            // using utilFunction
        }
    };
}();

Is there any benefit of giving the functions a name? As opposed to use anonymous functions. They are bound to either a variable or a property of the same name anyway.

Is this some kind of best practice? Does it maybe improve debugging?

I'm just asking, because I usually see the module pattern used with anonymous functions, and was now wondering.

Angelo.Hannes
  • 1,729
  • 1
  • 18
  • 46

1 Answers1

0

I think it is justified only when using anonymous functions for obvious reading, for example:

async.waterfall[
    function makeOne () {},
    function makeTwo () {},
];
Rax Wunter
  • 2,677
  • 3
  • 25
  • 32