JavaScript Module

A JavaScript module is a function or object that presents an interface that hides its state and implementation. Using functions to produce models, we can almost eliminate our use of global variables, thereby mitigating JavaScript's worst features.