3 ms·
> I think we are saying the same thing. Your term "pass reference by value" is the same as what I called "give a new name to an existing thing". >I simply like
by shkkmo 9y ago
> I think we are saying the same thing. Your term "pass reference by value" is the same as what I called "give a new name to an existing thing".
>I simply like to avoid the terms "pass by reference" and "pass by value" to avoid comparison with other languages.
The terms mean the same thing in every language. Some people (as shown in the article and this thread) don't understand what "pass-by-reference" means and incorrectly use it to apply to javascript.
The pass-reference-by-value behavior is shared by a lot of languages, I'm not sure why you want to avoid comparison with them.
- Stratoscope 9y ago> The pass-reference-by-value behavior is shared by a lot of languages, I'm not sure why you want to avoid comparison with them. That's a fair point. I just think a lot of JavaScript programmers are confused about this, and end up thinking that primitives and objects are passed in two different ways. Even MDN makes this mistake: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid... My use of "things" and "names" is just an attempt to get away from this confusion.