I have an Object of Objects. (because I want to use associative array, so object of objects, not numeric array of objects)
var tasks=new Object();
for(...){
tas
You can pass a function to the sort method of the Array object, which is used to determine the order of the objects in the array. By default, it does this alphabetically and numerically but the numerical way is a bit messed up. Here is how I'd solve your case, assuming that the indexes you're using to sort them are numerical:
tasks.sort(function(obj1,obj2){
return obj1.index - obj2.index;
});
The function passed to the sort method should return a positive integer if object1>object2, 0 if object1=object2, and a negative integer if object1