Modules
JavaScript modules are not new. In fact, there were have been libraries that support modules for some time now. ES6, however, offers built-in modules. Traditionally, JavaScript's major use was on browsers, where most of the JavaScript code was either embedded or small enough to manage without much trouble. Things have changed. JavaScript projects are now on a massive scale. Without an efficient system of spreading the code into files and directories, managing code becomes a nightmare.
ES6 modules are files. One module per file and one file per module. There is no module keyword. Whatever code you write in the module file is local to the module unless you export it. You may have a bunch of functions in a module, and you want to export only ...
Get Object-Oriented JavaScript - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.