โawait
turns Promise (future value) into a value/error.
JS โฉ statement โฉ expression โฉ operator โฉ unary โฉ await
(โญ๏ธ ES2017) (primary expression) (unary operator) turns a Promise / thenable into a return value / thrown exception.
if resolves normally, await returns the result.
if rejected, it throws error (as if there were a
throw
statement at that line).
await can only be used inside an async functionโ
modern browsers allow top-level await in modules.
Last updated
Was this helpful?