async Function

noun

say it: “AY-sink FUNGK-shun” /ˈeɪsɪŋk ˈfʌŋkʃən/

A JavaScript function marked async, which can use await and always returns a promise.

What is async Function in JavaScript?

async Function — A function that always returns a Promise and allows await in its body.

async function loadOrder() {
    const response = await fetch("/api/order");
    return response.json();
}

In a sentence

  • “loadProducts is an async function, so it can await fetch.”

Level: Journeyman · More JavaScript terms at this level

Updated