await java script code example
Example 1: await javascript
The await operator is used to wait for a Promise. It can only be used inside an async function within regular JavaScript code; however it can be used on its own with JavaScript modules.
Example 2: await javascript
If the value of the expression following the await operator is not a Promise, it's converted to a resolved Promise.