finding out which object to point to in javascript
<p>I have several global objects that contain arrays of objects; let's call these appointments. Let's say I have these objects: AppointmentsToday, Appointments02102012,  Appointments02092012... I also have a global variable CurrentAppointments that holds a reference to the actual object I'm currently working on.</p>

<p>The code looks somewhat like this:</p>

<pre><code>var CurrentAppointments = new Object();

var AppointmentsToday = new Object();
var Appointments02102012 = new Object();
var Appointments02092012 = new Objects()

ProcessNewAppointments(TheAppointments) {
  CurrentAppointments = TheAppointments;    
}

SomeFunctionThatDoesWork() {
  .... Some code to get the array index we want to work with
  CurrentAppointments[i].MyProp = SomeValue;
  ProcessAppointments(WHAT DO I PUT THERE??);
}

CallingFunction() {
   ProcessNewAppointments(Appointments02102012);
}
</code></pre>

<p>For instance, when I write ProcessNewAppointments(Appointments02102012) CurrentAppointments points to Appointments02102012 and when the function SomeFunctionThatDoesWork gets called, it changes the values of array Appointments02102012. So basically, when the function SomeFunctionTheDoesWork() gets called, it works on the object that's currently in CurrentAppointments, without worrying about which object to work on.</p>

<p>Now what I want to do is reexecute ProcessNewAppointments after SomeFunctionThatDoesWork gets called. How can I know the name of the object CurrentAppointments is pointing to so that I can write something like <strong>ProcessNewAppointments(TheNameOfTheObjectCurrentlyInCurrentAppointments).</strong></p>

<p>Thanks for your suggestions.</p>
