Limiting the call stack - mmedrano9438/peripheral-brain GitHub Wiki

The call stack is a data structure in JavaScript that contains the function(s) being executed. This structure is in a last-in-first-out format. Let's see an example:

`function printName() { console.log("Dillion") }

printName() // Dillion`

At first, the call stack is empty. When printName is declared, the call stack is still empty. When printName() is to be executed, it is added to the call stack:

  • all the lines in the function have been executed OR
  • a return statement is encountered in the function