The JavaScript Module Design Pattern also keeps things very simple, easy-to-read, use and uses Objects in a very nice way. Even better, it won’t bloat your code with repetitive this
and prototype
declarations.
Why use JavaScript design patterns?
Architecture—The layout of your code. It’s like the foundation and skeleton of a house. It’s one of the most important aspects when building scripts. It should define rules that govern how components like models, views, and controllers interact with each other.
Maintainability—Ensure your code can be easily improved and extended. In my opinion this is the second most important aspect when building JS applications. Don’t build your application so it’s locked down from improvement. Make sure you can teach your old dog new tricks
.
Reusability—Like with most programming, reusability is another important aspect when building your application. It’ll save you time and make maintaining it make easier.
Creating a JavaScript Module
https://benmarshall.me/javascript-module-design-pattern/