The Module Pattern
The key concept of the basic Module Pattern is to provide a simple function, class, or object that the rest of the application can use, through a well-known variable name. It enables us to provide a minimal API for a Module, by hiding the parts of the implementation that do not need to be exposed. This way, we also avoid polluting the Global Namespace with variables and utility functions that are needed for internal use by our Module.
The IIFE building block
In this subsection, we will get a small introduction to the IIFE Design Pattern since it's an integral part for all the variants of the Module Pattern that we will see in this chapter. The Immediately Invoked Function Expression (IIFE) is a very commonly used Design Pattern among JavaScript developers because of the clean way in which it isolates blocks of code. In the Module Pattern, an IIFE is used to wrap all the implementation in order to avoid polluting the Global Namespace and provide privacy to the declarations...