What is Module Pattern ?
It gives us the way to encapsulate the private and public methods and variables and protect our methods from the Global Scope.
Code Snippet :
Below is the example of Shopping Cart that’s being implemented with the Module Pattern.shoppingCart Module is itself a Global module.
Cart is an Array that’s Private so that other parts of the module can’t access it directly.