Appearance
Stack and Heap Memory
- In JavaScript, primitive values are stored directly in the stack, while reference types (objects, arrays, and functions) are stored in the heap. The stack holds the reference (memory address) to these heap objects, not the actual data.