I'm having a problem getting reverse() to reverse correctly. As it stands I have an array with 21 members. when I use reverse() on the array, at spots 10 and 21 they are placed at the bottom rather than in their normal order. I was under the assumption that reverse() is supposed to reverse the order, not rearrange the order.here's the code:
function myJobs(dateIn,task,url,dateOut){this.dateIn = dateIn;this.task = task;this.url = url;this.dateOut = dateOut;}theJobs = new Array();theJobs[01] = new myJobs("06.26.06","task1","my.url","06.26.06");theJobs[02] = new myJobs("06.26.06","task2","my.url","06.26.06");......theJobs[21] = new myJobs("06.26.06","task21","my.url","06.26.06");
further down i open a table, loop through the array, then close the table. here's the loop:
for(i in theJobs){document.write('<tr><td>'+theJobs[i].dateIn+'</td><td>'+theJobs[i].task+'</td><td>'+theJobs[i].url+'</a> </td><td>'+theJobs[i].dateOut+'</td></tr>');}
the idea behind this is to sort everything by date. newest date first. it's a glorified honey-do list. LOL. since i'm constantly adding new entries....it seems like a good idea to just reverse the order....but that's the problem. If there is a way better way to do this.....by all means...tell me. I'm not an expert.