I would like to know (confirm, hopefully) whether JavaScript manages its variable in a copy-on-write manner. This is important because I may end up dealing with possibly large strings, quite a few of them.
var a, b;
a = $(".foo").html();
b = a;
Is b
a deep copy or a copy-on-write? My code would benefit very much from a copy-on-write because in some cases I set b
to a different value (i.e. in most cases I copy a
, in other cases I set to, for example, "on"
or "off"
. However, it doesn't get modified later.)