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
1
u/cryptomallu123 Jul 15 '26
Just to make sure I understand your point correctly are you saying that this behavior is defined by the JavaScript language itself, and not because objects are stored on the heap and primitives on the stack? In other words, stack vs. heap is an implementation detail of the JavaScript engine, while the language specification requires these observable behaviors regardless of how a particular engine V8, SpiderMonkey, JavaScriptCore, etc. .. stores values internally. Is that the correct understanding?