JS passed by copy of a reference


js always call by value
> [Does Javascript pass by reference?](https://stackoverflow.com/questions/13104494/does-javascript-pass-by-reference)

the reference itself is passed by value

```typefunction replace(ref) {    ref = {};           // this code does _not_ affect the object passed}function update(ref) {    ref.key = 'newvalue';  // this code _does_ affect the _contents_ of the object}var a = { key: 'value' };replace(a);  // a still has its original value - it's unmodfiedupdate(a);   // the _contents_ of 'a' are changed```







