So my problem is simply, but i can't fix it. I have 2 objects one is temporary and second one is permanent, the temporary object taking data from permanent, but when i do actions on temporary, the permanent object chaing too example:
var permObject = {
data1: 1,
data2: 4,
}
tmpObject = permObject
tmpObject.data2 -= tmpObject.data1;
console.log(tmpObject.data2); //data2 = 3
console.log(permObject.data2); //data2 = 3
So my question is, how can i take data from permanent object to temporary object, but when i do actions on temporary object then permanent object will not change?