What we’ll discuss →

  1. Async functions vs Sync functions
  2. The real use of callbacks
  3. JS Browser Architecture
  4. Promises
  5. Async await

Async vs Sync →

Synchronous functions →

Asynchronous functions →

Intuition →

<aside> 💡 The human body and brain are single-threaded; we can only do one thing at a time

</aside>

  1. But, we can context switch between tasks,
  2. or we can delegate tasks to others

The same is true for JavaScript

Suppose you have 4 tasks →

  1. Boil water
  2. Cut vegetables