Re:Deep-copying in JavaScript
by k2xl on Thursday January 25, 2018 @05:33PM
(#16235344)
It isn't "if the value is an object then scope gets a copy of the reference" No new objects are created when you pass an object.
An object's value is a memory location. When you pass it as an argument you're passing that value into the method. The analogy is more akin to casting than copying.
An object's value is a memory location. When you pass it as an argument you're passing that value into the method. The analogy is more akin to casting than copying.