Re:Deep-copying in JavaScript
by Sawamara on Thursday January 25, 2018 @04:39PM
(#16234929)
Primitive types and properties that are primitive types are pass by value, objects and functions are pass by reference.
[ Parent
| on HN ]
It's still pass by value. The value of the object happens to be a reference to a memory location. A primitive also points to a memory location too.
Re:Deep-copying in JavaScript
by windwake12 on Thursday January 25, 2018 @04:55PM
(#16235065)
There's no difference
let a = function bar() { };
function foo( a ) {
a = 2;
}
foo( a );
console.log( a ); // bar