The call stack

The Call Stack is a really simple data structure that keeps track of program execution inside of a V8. It keeps track of the functions currently executing and the statements that are fired. The Call Stack is a really simple data structure that can do two things:

  • You can add something on top of it
  • You can remove the top item

This means if there's an item at the bottom of the data structure and there's an item above it, you can't remove the bottom item, you have to remove the top item. If there's already two items and you want to add something on to it, it has to go on because that's how the Call Stack works.

Think about it like a can of Pringles or a thing of tennis balls: if there's already an item in there and you drop one ...

Get Learning Node.js Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.