Engrain by ByteRush

JS.11 8 concepts · 7 ready

Async in depth

Implement and reason about promises, combinators, cancellation, races, retries and concurrency.

  1. JS.11.01Promise internals: states, reactions and resolutionCoreMid-level11 min
  2. JS.11.02Error handling in async codeCoreMid-level11 min
  3. JS.11.03Promise combinatorsCoreMid-level11 min
  4. JS.11.04Cancellation with AbortControllerCoreMid-level11 min
  5. JS.11.05Race conditions in the UICoreMid-level11 min
  6. JS.11.06Retry, timeout and backoffCoreMid-level12 min
  7. JS.11.07Concurrency controlCoreSenior10 min
  8. JS.11.08Async iteration and streamsSeniorBeing written

Interview questions in this module

  1. Explain the difference between Promise.all, allSettled, race and any. What does each return for an empty array?
  2. Implement Promise.all.
  3. How do you cancel a fetch request?
  4. Your search box sometimes shows results for an older query. Why, and how do you fix it?
  5. Implement retry with exponential backoff.
  6. Run 100 async tasks with at most 5 at a time, keeping results in order.
  7. What happens to an unhandled promise rejection in the browser and in Node?
  8. If Promise.race is used for a timeout, what happens to the slower promise?
  9. What is the difference between return promise and return await promise inside try?
  10. How would you implement an async queue?
  11. How do streams handle backpressure?