examerioLogin

Can you use await anywhere in JavaScript code?

πŸ“˜ Explanation

The rule is that await can only be used inside an async function, with the one exception being top-level await inside ES modules, so the answer naming that exception is correct. The option claiming it only works in Promise chains with no exceptions is wrong because the module exception exists, and the options saying it works in regular functions or anywhere are wrong because await requires an async context.

Related questions

← PreviousNo login needed