After researching various solutions to this issue, I have not been successful in implementing the commonly suggested fix. The variable evtList holds a collection of global objects labeled as "Event". Previous discussions advised creating a local object ("newEvent") within a loop, setting its properties, and then adding it to the global array. Despite following these steps, I have observed that modifying the newEvent object's elements results in all objects within the global array being updated with the same values before the addition operation. What am I overlooking here?
var i = 0;
var nextTime = new Date();
while (evtList[i].evtTime < dayEnd) {
i++;
var newEvent = new Event;
var milliSecs = (evtList[i-1].evtTime).getTime() + gaussian(arrStations[0].mean, arrStations[0].stdDev);
nextTime.setTime(milliSecs);
newEvent = ({value: 1, station: 0, evtTime: nextTime});
evtList.push(newEvent);
}