Using await at the top level in ES modules
Writing asynchronous code in JavaScript used to come with a limitation: the await keyword could only be used inside an async function. That changed when ES2022 introduced top-level await, a modern ES module feature that enables new patterns for asynchronous code at the module level. What’s top-level await? Traditionally await...