let value = await Promise.resolve(42);
console.log(value);
This code will error because await is used outside an async context: 1) await can only be used inside async functions, 2) Top-level await is only allowed in modules, 3) Regular scripts don't support top-level await, 4) The code needs to be wrapped in an async function, 5) Alternative is to use .then() for Promise handling, 6) ES2022 adds support for top-level await in modules only.