5 ms·
Primitive types and properties that are primitive types are pass by value, objects and functions are pass by reference.
by Sawamara 9y ago
Primitive types and properties that are primitive types are pass by value, objects and functions are pass by reference.
- windwake12 9y agoThere's no difference let a = function bar() { }; function foo( a ) { a = 2; } foo( a ); console.log( a ); // bar
- k2xl 9y agoIt'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.