Question from the Javascript test

Write a module in Javascript

Hard

What is the name of the pattern used in this piece of code:

var myModule = (function($, _) {

  function doSomethingPrivate() {
    // ...
  }

  return {
    publicMethod : function() {
      doSomethingPrivate();
    }
  };

})(jQuery, _);
Author: Jean-marie CléryStatus: PublishedQuestion passed 1939 times
Edit
2
Community EvaluationsNo one has reviewed this question yet, be the first!