Modularization is a popular technique used in modern programming languages that allows programs to be built from a series of smaller libraries, or modules. Writing programs that use modules encourages programmers to write code that conforms to the design principle called Separation of Concerns. The basic principle of Separation of Concerns is that we should program against a defined interface. This means that, the code that is implementing this interface can be refactored, improved, enhanced, or even completely replaced without the rest of the program being affected. This also helps when testing our code, since the code that is providing the implementation of an interface can easily be stubbed, or mocked out in a test scenario.
JavaScript, prior to ECMAScript 6, did not have a concept of modules. Popular frameworks and libraries, such as Node and Require, implemented...