Building Your Learning Module...
Getting things ready for you!
Find videos you like?
Save to resource drawer for future reference!
The call stack is a data structure that JavaScript uses to keep track of function calls. Like a stack of plates - last in, first out (LIFO)!
Program starts - call stack is empty
// Code execution beginsWhen a function is called, it's pushed onto the top of the stack.
When a function returns, it's popped off the top of the stack.
See how functions are tracked
function recursive() {
recursive(); // Calls itself forever!
}
recursive(); // ❌ Stack overflow!What causes stack overflow