Top-Level Await
Noun · Development
Definitions
A JavaScript feature (ES2022) that allows the `await` keyword to be used at the module's top scope rather than only inside async functions, causing the module to asynchronously resolve before any dependent modules execute — useful for dynamic imports, config loading, and database connections at startup.
In plain English: A JavaScript feature that lets you wait for something (like loading data) right at the start of a file, instead of needing a special wrapper function.
Example: "With top-level await I can just write `const db = await connect()` at the top of the module instead of wrapping everything in an async IIFE."