Hi there,
I am using an array of objects to simulate an associative array, it is declared as follows:
So I can the reference the array using nan12h[0]['name'] etc.
Later on I want to iterate through the array and remove any items that have finished using this code:
This works fine except that the array now starts from 7 instead of 0. Is there any simple way to reorder the array at this point or is it a case of writing a custom function?
G
-Geeeeeeeeeeeeeeeeeeeeeeee-
I am using an array of objects to simulate an associative array, it is declared as follows:
Code:
nan12h = { "0": { "count": "24", "name": "Cash in the Attic", "starttime": "11:30", "startstamp": "1218108600", "endtime": "12:15", "endstamp": "1218111300", "description": "Sheila Long\'s daughter is planning to go to New Zealand. Before she heads off, the family wants to raise money for a walking weekend together in the Lake District. [S] Then BBC News." }, "1": { "count": "24", "name": "Bargain Hunt", "starttime": "12:15", "startstamp": "1218111300", "endtime": "13:00", "endstamp": "1218114000", "description": "The bargain hunters are scouring an antiques fair in the grounds of Deene Park near Corby, Northamptonshire, aided by the two expert Davids, Barby and Harper. Tim Wonnacott presents. [S]" }, "2": { "count": "24", "name": "BBC News at One", "starttime": "13:00", "startstamp": "1218114000", "endtime": "13:30", "endstamp": "1218115800", "description": "National and international news from the BBC, followed by Weather. [S]" }}
So I can the reference the array using nan12h[0]['name'] etc.
Later on I want to iterate through the array and remove any items that have finished using this code:
Code:
if (newArr[x]['endstamp'] < nowtime) {
delete newArr[x];
}
This works fine except that the array now starts from 7 instead of 0. Is there any simple way to reorder the array at this point or is it a case of writing a custom function?
G
-Geeeeeeeeeeeeeeeeeeeeeeee-