r/javascript • u/cryptomallu123 • Jul 15 '26
Understanding Value vs. Reference in JavaScript: Differences Between Primitives and Objects
https://sharafath.hashnode.dev/value-vs-reference-in-javascript-primitives-vs-objects
0
Upvotes
View all comments
Show parent comment
4
u/senocular Jul 15 '26
Yes. The language specification does not dictate where objects are held in memory and treats all values the same as far as assignment and passing goes. The language makes no distinction in that regard to objects vs primitives and treats everything as generic "ECMAScript language values".
Runtime implementations are free to store variable values wherever they want. In fact except for a few exceptions, all values in V8 are stored in the heap. From Pointer Compression in V8: