Too Long; Didn't Read
The Module pattern was originally defined as a way to provide both private and public encapsulation for classes. The module pattern is similar to factory functions as we create an object without the nuances of using the “new” keyword. We will try to implement the code using the revealing module pattern and later will emphasize what’s going on with the code snippet. We have declared a few private properties and 2 private methods to calculate the discount on the shopping cart item list. The public method we return from our module will invoke the public method.