Understanding Javascript’s event loop and call stack
summary
JavaScript runs single-threaded — one thing at a time while browsers provide V8 and browser Web APIs to offload work; demos use setTimeout and Promises to show how callbacks move from Web APIs into the task queue or the higher-priority microtask queue before task queue. Code examples reproduce ordering quirks (start/middle/end, promise then callbacks before zero-delay timeouts) and note Chrome caps call-stack depth roughly between 10 and 50,000. Slides and runnable examples are published for verification.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:45Why event loop matters
- 3:30JavaScript single-threaded runtime
- 9:09Call stack fundamentals
- 13:00Web APIs and async code
- 15:05Task queue explained
- 18:13Event loop mechanics
- 22:03Recap of key concepts
- 23:05Microtask queue deep dive
- 25:40Promise execution flow
- 27:45Live code examples
- 30:17Key takeaways summary
- 31:00Q&A and closing
