JavaScript’s answer to “packaging” or namespacing can be expressed rather succinctly—it was nonexistent. This has been one of the most glaring omissions in the language design since the beginning, and has led to a variety of attempts at modularizing code. These ranged from homegrown solutions to full-blown specifications like AMD.1
ES6’s answer to this problem is modules. In this chapter we will learn how to create and consume modules using the new support for the same provided in ES6. We will be ready to do away with hacky solutions like IEFEs, and be ready to embrace a consistent, platform ...