JS Built-ins
AsyncPatternsadvanced

async function with no return resolves undefined

πŸ“– Usage Example
async function fetchData() {
  const data = await Promise.resolve(42);
  return data;
}
// await pauses inside the async function

await pauses execution inside an async function until the Promise resolves.

Async Function Resolution

An async function with no explicit return statement resolves to undefined.

Challenge: Verify that an async function without return still returns a Promise.

πŸ’‘ Hints (3)
  • β€’ All async functions return Promises.
  • β€’ No return means the Promise resolves to undefined.
  • β€’ Each call returns a new Promise instance.