async function. The await keyword is just legitimate inside async functions. Outside of an async function’s body, you will get a SyntaxError if you use it .
With this web web web Page
An async function is a function declared because of the async keyword. Async functions are cases of the AsyncFunction constructor, while the await keyword is permitted within them. The async and await keywords enable asynchronous, promise-based behavior become written in a cleaner design, steering clear of the have to explicitly configure vow chains.
Async functions may be understood to be expressions.
Syntax
Parameters
Return value
A Promise that will be fixed utilizing the value came back by the async function, or refused with a exclusion tossed from, or uncaught within, the async function.
Description
Async functions can include zero or higher await expressions. Await expressions suspend progress through an async function, yielding control and later resuming progress only if an awaited promise-based asynchronous operation is either fulfilled or refused. The solved value associated with the vow is addressed given that return value of this await phrase. Use of async / await enables the employment of ordinary try / catch blocks around asynchronous code.