I am relatively new to Javascript and am working on a large project currently written exclusively in js. One of the concepts I read is
Passing an object through an object.
The following code seems to ignore the rule that js passes the link in case of objects.
var a = {b:2};
var modify = function(a) {a = {d:4}};
modify(a);
print a;
Why has the value of a in the above example not changed?
Note. The http://snook.ca/archives/javascript/javascript_pass states that objects are passed by reference in Javascript.
source
share