DEV Community 👩‍💻👨‍💻

Discussion on: Async Await Behavior

peerreynders profile image

I believe the issue is attempting to discuss async/await in isolation of the foundational concepts.

Tasks, microtasks, queues and schedules

  • Foundation: event loop, task, microtask (queues)
  • How promises relate to mictrotasks
  • How async/await relates to promises

In the presence of working knowledge about the event loop, tasks, microtasks, and promises one can call on the pertinent details without getting bogged down in supplementary explanations.

Forming an effective mental model around async/await without understanding the rest is prone to oversimplification that will eventually cause problems (like failing to use functions like Promise.allSettled() and friends).

await vs return vs return await