I have an array of 20 objects BaseObjects called ArrayBaseObjects. The user calls an object, it's loaded in the UI, and he makes changes to the properties. Something like this:
var ArrayBaseObjects = new Array();
var CurrentObject = null;
function OpenRecord (TheIndex) {
CurrentObject = ArrayBaseObjects[TheIndex];
}
function RecordChanges() {
// bunch of statements that make changes to CurrenObject
CurrentObject.CrazyStuff = NewValue;
}
The problem is that when the user makes changes to the CurrentObject, it also changes the value of the ORIGINAL object in ArrayBaseObjects.
I don't understand why?? When I write CurrentObject = ArrayBaseObjects[TheIndex];
why does changing CurrentObject also affect the value of the objects in ArrayBaseObject??
I'm looking to compare that value between the orignal object and CurrentObject the user made changes to, but they're always the same! What changes do I need to make to get this to work the way I intend it?
Thanks for the explanation.