A Simple Guide to Heaps, Stacks, References, and Values in JavaScript

A common concept in software engineering, in general, is the idea of reference versus value. JavaScript has an interesting way of storing variables, objects, and functions, and misunderstanding this can lead to confusion further down the road. Developers need to know how these concepts work since it is fundamental to JavaScript. This article will cover how JavaScript manages values and references, which will pay dividends when working on complicated applications and websites.

Memory Storage in JavaScript

To understand what we mean when we say JavaScript stores values and references, we need to understand where JavaScript stores them. There are two places JavaScript stores this data: