This may be an old question but I'm really curious about the nature of copying objects by reference as an assignment in javascript.
Meaning that if
var a = {}; var b = a; a.name = "Renato"; console.log(b); Object {name: "renato"} I'm kind of new to javascript and this really caught my attention to have a shallow copy as a default for Object assignment. I searched that in order to create a hard copy, you have to create a mixin. I was wondering why was this chosen as the default since it's transformation seems to be very implicit. Thanks!
wondering why was this chosen as the defaultBecause in most cases it would be the best option, .. Javascript is a Garbage Collected environment, one of it's strengths is be able to pass objects about without having to worry about memory leaks. And the other advantage is speed..