javascript persisting changes
<p>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:</p>

<pre><code>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;
}
</code></pre>

<p>The problem is that when the user makes changes to the CurrentObject, it also changes the value of the ORIGINAL object in ArrayBaseObjects.</p>

<p>I don't understand why?? When I write <code>CurrentObject = ArrayBaseObjects[TheIndex];</code> why does changing CurrentObject also affect the value of the objects in ArrayBaseObject??</p>

<p>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?</p>

<p>Thanks for the explanation.</p>
