Possible Duplicate:
What is the most efficient way to clone a JavaScript object?
Copying an Object in Javascript
If I have this
var a = {};
a.test1 = 1;
a.test2 = 2;
and then I do
var b = a;
b.test1 = 5;
I don't want that a.test1 also changes. How can I get a new reference or object ?