Language concepts
async function declaration
Declares a function whose calls produce promises. Normal returned values resolve the result; thrown errors reject it. Await can suspend its evaluation.
Formal Syntax & Structure
javascript syntaxjavascript
async function name(...args) { /* body */ }Working Example
Example Snippetjavascript
async function run() { console.log("enter"); const n = await 3; console.log(n); return n * 2; }run().then(console.log);console.log("outside");