I have a global JSON variable where I store some parameters, and then every time I run the function, I want to be able to change them, but only locally inside this function.
Therefore, every time I run the function, I want to get a new copy of the global variable inside the local one.
The problem is that I copy the global variable to a local variable defined in the function and I make changes to the local variable, but the next time I run this function, instead of having an intact copy of the global variable, I have one where I have already modified things.
Thank!:)
var test = {"name":"me"};
function bla() {
var t=test;
t.name="you";
t.age=55;
alert(test.name);
}
bla();