tags:

views:

35

answers:

2

I know, I've found many examples to sort an Object. But that makes me a little bit confused (I am not so pro to check wich is the fastest and cleanest method for me).

I hope somebody can help.

My Object looks like

tt_results = {};
tt_results[6815631] = new Array('85', 'blibee', 'blaerb', 'bluo', 'tkone', 'tkeeee_seve', '382261471' );
tt_results[1563157] = new Array('25', 'blib', 'blab', 'bluerro', 'tkerone', 'tk_seve', '382266851' ); 

I want to sort the timestamp.

Thanks in advance!

Peter

+1  A: 

As has been mentioned in the comment you cannot sort objects.

In terms of general js performance a good resource for x-browser tests & results check out jsperf. There is an array sort test here

redsquare
Thank you for the nice test Page.
Peter
+1  A: 

See my answer to a similar question here: http://stackoverflow.com/questions/3368036/trying-to-sort-a-custom-javascript-object/3368210#3368210

Basically, you can't sort objects themselves - it doesn't make sense. But you can process the object in sorted order by sorting the keys and then iterating over the sorted keys.

slebetman