0

I have paid attentions that some developers use Module Pattern like this:

var test = (function() {
myMethod = function() {
    // some stuff        
};

return {
    publicMethod: myMethod        
}
})();

and some like this:

var test = (function() {
myMethod = function() {
    // some stuff        
};

return {
    publicMethod: myMethod        
}
}());

The difference is at the end for brackets inside or outside of a function. It has probably nothing to do with a pattern itself but with a function. Could anyone explain the difference, or provide a link where all this stuff has been well explained?

Matt Ellen
  • 11,268
  • 4
  • 68
  • 90
Kanan Farzali
  • 991
  • 13
  • 23

1 Answers1

0

All abut module pattern explained in addy osmani book for javascrip design pattern's. html version exist here : http://addyosmani.com/resources/essentialjsdesignpatterns/book/