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 1785 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!