Asynchronous processing
An explanation, with diagrams, of the path from callbacks to Promises and async/await. Covers choosing between Promise.all / allSettled / any, and the execution order driven by microtasks, in a beginner-friendly way.
An explanation, with diagrams, of the path from callbacks to Promises and async/await. Covers choosing between Promise.all / allSettled / any, and the execution order driven by microtasks, in a beginner-friendly way.
JavaScript が 1 本のスレッドで通信もタイマーも捌ける仕組みを、タスクとマイクロタスクの実行順から解説します。await の続きがいつ動くか、setTimeout(fn, 0) が「すぐ」ではない理由、長いタスクが描画と操作を止める仕組み、重い処理を逃がす 3 つの方向を扱います。