Question: I just found out the hard way objects are passed by reference in Javascript, for example:

```
for(var layer = 0; layer < hudLayers['layers'].length; layer++){

    // Store the to-be-calculated values in this object
    var tempValues = hudLayers['layers'][layer];

    tempValues['name'] = 'test';
}

```

This will change the value in tempValues and hudLayers.
(Seems kind of obvious, but a post without a bit of code seems so naked.)

Is there a quick way around this?

Answer: 
There is no pass by reference in JavaScript. Objects are accessed through references and those references are assigned or passed passed by value, just like in Java
Making a deep copy of an object is as simple as `objCopy = obj.toSource();`.

[.toSource on MDN](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/toSource)