Modular programming is one of the most important and frequently used software design techniques. Modular programming basically means splitting your code into multiple files that are usually independent of each other. This makes it a cake-walk when managing and maintaining different modules of a program. It helps in debugging nasty bugs easily, pushing updates to a particular module, and so on.
Unfortunately, for a long time, JavaScript didn't support modules natively; that led programmers to use alternative techniques to achieve modular programming in JavaScript. However, ES6 introduced a native modular technique in JavaScript for the first time.
This chapter is all about how to create and import JavaScript modules. In this chapter, we will first learn how modules were created earlier, and then we will jump to the new built-in JavaScript module system...