June 2018
Beginner
288 pages
6h 31m
English
Simply put, in JavaScript, a module is an individual file that contains variables, constants, functions, and classes. Modules follow the Vegas theme: “What happens in Vegas stays in Vegas.” Code within a module is executed in strict mode—you don’t need to specify ’use strict’;—so the variables within a module do not accidentally spillover to global scope.
The author of a module has to carefully choose what to export from the file to the outside world. All else is invisible and unreachable directly from the outside. Likewise, for a module to use something that’s not part of it, it first has to import it. Once imported, the reference becomes part of the current module’s scope.
Read now
Unlock full access