Module
Definition
A self-contained unit of code that exports specific values (functions, objects, classes) and imports what it needs from other modules. ES modules use `import`/`export` syntax.
Code Example
Tip: Modify the code above and click “Run” to see the results
Learn More
Related Terms
Scope
The region of code where a variable is accessible. JavaScript has global scope, function scope, and block scope. Block scope was introduced with let and const in ES6.
IIFEImmediately Invoked Function Expression — a function that runs immediately after being defined. IIFEs create a private scope and are used to avoid polluting the global namespace.