I am relatively new to Javascript and working on a big project currently written exclusively on js. One of the concept I have read is
Passing in an object, passes it in by reference.
Following code seem to defy the rule that js passes reference in case of objects.
var a = {b:2};
var modify = function(a) {a = {d:4}};
modify(a);
print a; //a is still {b:2}.
Why has the value of a in the above example hasn't changed?
Note: It is mentioned in http://snook.ca/archives/javascript/javascript_pass that objects are passed by reference in Javascript.