Every function you call in JavaScript gets pushed onto a structure called the call stack. That's how JS knows where to go back. Whatever sits on top of the stack is where execution is right now. When the function returns, it gets popped off - and the item below it is back on top, telling JS exactly where to return to. Without this, calling a function from the middle of another function would leave JS completely lost. There would be no "go back to where you were." One side effect: the call stack has limited space. If a function calls itself infinitely with no stopping condition, you get a stack overflow. The name makes perfect sense once you know what it actually is. Next: JS borrows the browser's timer and network - but the browser doesn't hand results back through the call stack. How does it communicate? #JavaScript #WebDevelopment #Programming #SoftwareEngineering

To view or add a comment, sign in

Explore content categories