See each function's context
Function entry and exit
Understand stack traces
Variable resolution
Click "Visualize" to see how the call stack evolves during execution.
The call stack is a LIFO (Last In, First Out) data structure that tracks function execution.
Error stack traces show the call stack at the moment of failure, helping you debug.
function a() { b(); }
function b() { c(); }
function c() { throw new Error('!'); }
// Error stack:
// Error: !
// at c
// at b
// at a
Forgetting a base case causes endless recursion until the stack overflows.
function forever() {
forever(); // No base case!
}
forever();
// RangeError: Maximum call
// stack size exceeded
It varies by browser and environment - typically between 10,000-25,000 frames. Chrome and Node.js have around 10,000-15,000, while some environments allow more.
When await is encountered, the function is paused and removed from the stack. When the Promise resolves, the function resumes via the micro task queue, creating a new stack frame.
Single-threading simplifies development by avoiding race conditions and deadlocks. The event loop provides concurrency without the complexity of multi-threading.