I co ordinates stored as an object and have duplicated the data so i have a copy before the co ordinates change. But the problem is, when I change the co ordinates both copies change to the new version and I lose the original.
So i create it like this:
myObj = {};
myObj.position = {'x':12,'y':24};
myObj.startPos = myObj.position;
So if i change myObj.position
, I don't want myObj.startPos
to change. What is the simplest way to prevent this from occurring?