concept module pattern in category angular

appears as: module pattern, The module pattern, module pattern, module patterns
Getting MEAN with Mongo, Express, Angular, and Node.js 2ED

This is an excerpt from Manning's book Getting MEAN with Mongo, Express, Angular, and Node.js 2ED.

This closure approach is a great start, but it has evolved into more useful patterns. For example, take a look at the module pattern.

Listing D.55. Revealing module pattern, short example
const userAge = (function () {
  let myAge;
  const setAge = function (initAge) {  #1
    myAge = initAge;                   #1
  };                                   #1
  return {
    setAge                             #2
  };
})();