Languages / JavaScript Core
Asynchronous JavaScript
Callbacks, promises, async/await, cancellation, and observables.
Asynchronous data handling
JavaScript runs user code on one thread per realm, yet programs must respond to timers, network I/O, and user input without blocking. This overview maps callbacks, promises, async/await, cancellation, and observables—and when each fits.
Callbacks and timers
Host APIs still expose completion handlers as functions you pass in. This chapter covers callback conventions, setTimeout and setInterval, and why nested callbacks led to promises and async/await.
Promises in JavaScript
A Promise represents one eventual result—fulfilled or rejected—and gives shared combinators for sequencing and racing async work. This chapter covers construction, then/catch/finally, Promise.all, and common pitfalls.
Async/await in JavaScript
Async functions always return a Promise, and await pauses until a Promise settles—giving sequential async code without nested then chains. This chapter covers syntax, parallel awaits, and error handling patterns.
Cancellation with AbortController
Promises do not cancel themselves; AbortController provides a standard signal for fetch, streams, and your own async tasks. This chapter covers signals, abort reasons, and cleaning up listeners when work is no longer needed.
Observables in JavaScript
Observables push many values over time and support unsubscribe, which suits events and live streams but adds weight promises avoid. This comparison chapter covers push versus pull, RxJS basics, and when to stay with promises.