What is the module pattern in JavaScript?

The module pattern uses closures to create private/public members.

const counter = (function() {
  let count = 0;
  return {
    increment() { count++; },
    getCount() { return count; }
  };
})();