Echo JS 0.11.0

<~>
xat 2475 days ago. link 1 point
Sorry, I know it might not be that cool to post a link to a Reddit discussion.

That said, IMHO it's quite useful to understand that even if you're passing​ object like things as arguments into functions, it's still call by value. You're copying a reference in that case.

Replies

MaxArt 2475 days ago. link 1 point
Yes, but on a more practical side, it makes little difference: you copy that reference to work with the object it points to.
If you take PHP. instead, as long as they're arrays (for those who don't know the evil of PHP, they're the equivalent of *both* JavaScript's Array and Object instances), it makes *deep* copies of them, and you have to use the & operator to get refrences instead. (Class objects are always passed as in JavaScript instead - did I mention that PHP is evil?)