You can use an IIFE here (Read more about it here)
(async function main () {
// You can use await inside this function block
})();
More Related Contents:
- Is it an anti-pattern to use async/await inside of a new Promise() constructor?
- How to return values from async functions using async-await from function? [duplicate]
- SyntaxError: Unexpected token function – Async Await Nodejs
- Understanding async/await on NodeJS
- using async await and .then together
- Does an async function always need to be called with await?
- Async/Await Class Constructor
- Understanding the Event Loop
- How can I use async/await at the top level?
- I know that callback function runs asynchronously, but why?
- JavaScript, Node.js: is Array.forEach asynchronous?
- Node JS Promise.all and forEach
- How can I wait In Node.js (JavaScript)? l need to pause for a period of time
- How to write asynchronous functions for Node.js
- Can’t throw error from within an async promise executor function
- for await of VS Promise.all
- node.js async/await using with MySQL
- ‘await Unexpected identifier’ on Node.js 7.5
- How to use ES8 async/await with streams?
- How to return an Ajax result using async/await? [duplicate]
- Please point out the misfacts in my learning regarding Asynchronous Javascript
- Async / await vs then which is the best for performance?
- Why couldn’t popular JavaScript runtimes handle synchronous-looking asynchronous script?
- How to handle errors from setTimeout in JavaScript?
- Using mongoose promises with async/await
- Wait promise inside for loop
- How does javascript async/await actually work?
- Using “await” inside non-async function
- JavaScript asynchronous programming: promises vs generators
- Why I got document is not defined error in puppeteer?