3 ms·
> 1) Strong Preference for Immutable Data: Javascript's object model isn't particularly confusing: If it's not a primitive, it's a reference. No, everything is
by bsder 13y ago
> 1) Strong Preference for Immutable Data: Javascript's object model isn't particularly confusing: If it's not a primitive, it's a reference.
No, everything is ALWAYS a reference.
This is, in fact, enshrined in the ECMAScript standard. Everything is a reference, and gets passed to GetValue() when required.
Now, some of the JIT's do a phenomenal job of backing this out, but it's always a hazard.
There is a reason that the newer versions of ECMAScript are trying to specify constant type variables and immutability in globals.