module
Last updated
Was this helpful?
Last updated
Was this helpful?
⟩ module
Modules provide structure to bigger programs by separating the code into pieces with clear interfaces and dependencies.
interface: the part that’s visible from other modules.
dependencies: other modules that it makes use of.
in Node.js, each JS file is treated as a module.
in a module there's no "module scope object" for these top-level declarations to be added to as property.
( 👉 compare: global var / function is global object property❗️)
JS.info ⟩
Eloquent JS ⟩
DEV ⟩
MakeUseOf ⟩
YDKJS: Scope & Closures (v.2) > Chapter 8:
(YouTube)
rename file extension to .mjs