I'm trying to populate an array with a list of dates.
When I go back to retrieve a date in the array, they are all the same date.
var paydates = new Array();
var i;
var firstDate = new Date();
firstDate.setFullYear(2010, 11, 26); //set the first day in our array as 12/26/10
for (i=0; i < 200; i++) //put 200 dates in our array
{
paydates[i] = firstDate;
firstDate.setDate(firstDate.getDate()+14); //add 14 days
document.write("1st: " + i + ":" + paydates[i] + "<br />");
//this lists the dates correctly
}
//when I go back to retrieve them:
for (i=0; i < 200; i++)
{
document.write("2nd: " + i + ":" + paydates[i] + "<br />");
//this lists 200 instances of the same date
}
It's probably something stupid, but I'm at a loss.
Thanks