Module loading

Modules concern code organization, which is how the functionalities of an application are distributed in units that simplify reusability, maintainability, and understandability of the code. The concept of module itself does not concern how it is loaded into the execution environment. Usually, this should be a concern of the runtime engine hosting the application. However, module loading plays an important role in JavaScript, as we will see in this section.

Modules, scripts, and files

In the examples we have shown so far, we have not said where the modules are. Until now, we talked about modules as units of code with private and public parts, but where do they live in an application?

In general, one or more modules can be in the same ...

Get Mastering JavaScript Object-Oriented Programming 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.