Example 1 — Example
Typical usage.
JavaScript
async function f() { return 7; }
console.log(f.constructor.name);
f().then(console.log);How It Works
- async function. Returns a promise.
- constructor.name. AsyncFunction.
AsyncFunction is the constructor of async functions. Everyday code should use async function / async arrows instead of new AsyncFunction.
async function f() { return 7; }
console.log(f.constructor.name);
f().then(console.log);Typical usage.
async function f() { return 7; }
console.log(f.constructor.name);
f().then(console.log);Check browser support for newer APIs.
console.log("AsyncFunction — see MDN for support tables");CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful