JSFiddle - React, Tailwind, and code Playground
by MarkSchultheiss
JavaScript
var appointment = {
Id: "newId",
Name: "newN",
MyProp: "newP"
};
var CurrentAppointments = {
appoint: [appointment]
};
CurrentAppointments[0] = appointment;
CurrentAppointments[1] = appointment;
CurrentAppointments[2] = appointment;
var Appointments02092012 = {
appoint: [appointment, appointment, appointment]
};
Appointments02092012[1] = {
Id: "myid",
Name: "myName",
MyProp: "aprop"
};
var AppointmentsToday = {};
var Appointments02102012 = {};
var Appointments02092012 = {};
Appointments02102012[1] = appointment;
Appointments02102012[1] = {
Id: "mynewid",
Name: "mynewName",
MyProp: "apropdiff"
};
function ProcessNewAppointments(TheAppointments) {
CurrentAppointments = TheAppointments;
}
function SomeFunctionThatDoesWork(workingAppointment) {
var SomeValue = "house";
var i = 1;
CurrentAppointments = workingAppointment;
CurrentAppointments[i].MyProp = CurrentAppointments[i].MyProp +SomeValue;
ProcessNewAppointments(workingAppointment);
}
function CallingFunction() {
ProcessNewAppointments(Appointments02102012);
}
CallingFunction();
var currentIndex = 1;
SomeFunctionThatDoesWork(CurrentAppointments);
alert(CurrentAppointments[currentIndex].MyProp);
alert(Appointments02102012[currentIndex].MyProp);