The Module Pattern in Javascript (aka Immediately-Invoked Function Expression aka IIFE)

Javascript modules are a design pattern that allow you to encapsulate your code into smaller self managing pieces. They help you separate your code, protect your variables, and provide an easy way to expose only the parts of your component that you want to be exposed.