Callbacks and the Event Loop
JS runs on one main thread. Async work is scheduled; callbacks run later when the event loop allows.
- setTimeout queues a macrotask.
- Promises queue microtasks.
- Never block the thread with busy waits.
console.log("A");
setTimeout(() => console.log("C"), 0);
console.log("B");
Write may be quiz-only here โ focus on the order A, B, then C.