1
JavaScriptIntermediate#async#performance
async marks a function as returning a promise; await pauses that function until the awaited promise settles, without blocking the main thread. Errors are handled with try/catch.
async function load() {
try {
const res = await fetch('/api/users');
return await res.json();
} catch (e) {
console.error('failed', e);
}
}