DEV Community 👩‍💻👨‍💻

Discussion on: Async Await Behavior

Collapse
365erik profile image
Erik Smith Author

I take your point on clarity and will have to ponder how to reword some of it without bogging it down with too much detail.

Collapse
peerreynders profile image
peerreynders

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