Skip to main content

Explain modules vs global scripts.

Junior JavaScript
Quick Answer Modules (ESM): each file has its own scope, explicit import/export, statically analyzable, async loading. Global scripts: all variables land in the global scope รขโ‚ฌโ€ name collisions, hard to tree-shake, load order matters. Modules are the modern standard รขโ‚ฌโ€
Ready to level up? Start Practice