Kikobeats / js-mythbusters

:ghost: STHAP js, where is my perf?
https://mythbusters.js.org
MIT License
632 stars 68 forks source link

Passing arguments by reference vs value #68

Closed Kikobeats closed 5 years ago

Kikobeats commented 6 years ago

Javascript is always pass by value, but when a variable refers to an object (including arrays), the "value" is a reference to the object. Changing the value of a variable never changes the underlying primitive or object, it just points the variable to a new primitive or object. However, changing a property of an object referenced by a variable does change the underlying object.