Take the 2-minute tour ×  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?
share|improve this question You want to assign a value to
tempValues and have it not reflected in the hudLayers? Why would
you want that? –  Abhinav Sarkar Jul 19 '10 at 19:30 You really
want to know? :) hudLayers contains several variables of image
widths and heights. It's a HUD, so it has to be drawn multiple
times per second. What's in hudLayers is actually the
"blueprint" (base the width of this image on the value of that
variable, ...) If I simply write that back to hudLayersthe
blueprint is gone and the image on screen will