Promise, async, await

  • Event loop checks stack and if it is empty, it sends first item(callback)inside queue to stack
  • In JS, cannot render if there is a code in stack and has to wait until stack is clear.
  • Rendering has higher priority over callback so every 16 milliseconds, it is going to queue render, wait til stack is clear before it can actually do the render.
  • While doing slow synchronous loop, render is blocked so cannot select text in screen, and etc.
  • But if it is asynchronous, it is still blocked while we queue up but it clears out relatively quick because we give the render a chance between each element since it was queued up asynchronously to jump in there and do the render
  • a JavaScript object for asynchronous operation
  1. pending (while operation)
  2. fulfilled
  3. rejected


  • when new Promise is created, the executor runs automatically!

Consumers: then, catch, finally

Promise Chaining

  • promise chain는 같은 객체를 리턴하지 않고 항상 다른 promise를 리턴하게 됨

Error Handling

async & await

  • clear style of using promise
  • promise를 위에 더 간편한 API를 제공하는 것 => Syntactic Sugar

Error Handling



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store