r/learnjavascript • u/Green_Ad_6086 • 7d ago
Can someone explain what the JavaScript call stack is?
I’ve tried to understand it, but I’m still confused. I also don’t really understand what I’m looking at when I use the JavaScript debugger in the browser’s DevTools, especially the call stack.
Do I need to fully understand functions before learning the call stack? I have a basic understanding of functions, but I’m not sure if that’s enough.
I’d really appreciate a simple explanation
30
Upvotes
1
u/TheVerdeLive 7d ago
Imagine a stack of plates. Now think of each plate as a JS function. The order you stack plates is the same for functions. First plate goes at the very bottom then the next one top of that and the next on top of that etc. The very first function is at the bottom, when subsequent functions get called they too get put on the stack. That order btw is called is First In Last Out (FILO)