ARTICLE AD BOX
I am confused about the storage of JavaScript values. I have seen two different explanations:
Explanation 1:
Primitive types are stored on the stack.
Reference types are stored on the heap.
Explanation 2:
If a variable is global, it is in the Global Object (GO) -> stored in the heap.
If it is in a function, it is in the Activation Object (AO) -> also stored in the heap.
Which one is correct? Is this a difference between a conceptual model and the actual engine implementation?
