Visual representation of the JS event Loop

The Call Stack and Memory Heap explained.

Cameron J. Leverett
Nerd For Tech
Published in
1 min readApr 9, 2021

--

The call stack and Heap won’t interfere with your day-to-day workflow. However, it is crucial to understand call stack and memory heap. They are foundational concepts that every software engineer should understand. Just keep in mind that the Stack and Heap are not exclusive concepts to JavaScript. Other low-level languages use such as C and C++ these languages use stack and Heap as well.

What is the Call Stack?

The call stack is responsible for keeping the flow of execution for our application. Without it, JavaScript wouldn’t know what to call or when.

Let’s review an example of how we can communicate to the call stack.

What is the memory Heap?

The Heap is responsible for storing our data. This is where the memory allocation happens.

let’s review the following

Since all the JavaScript engines are all different, where variables are allocated isn’t always the same. For the most part, you can think of it like this. More simple variables will be stored in the stack, and more complex variables such as Objects, Arrays, and more complex data structures.

--

--

Cameron J. Leverett
Nerd For Tech

I love tackling new and exciting challenges and working with software because it’s consistently changing, which is exciting.