I have an array of objects of the following form:
arr[0] = { \'item1\' : 1234, \'item2\' : \'a string\' };
I sort it first by \'item1\'>
Or as simple oneliner for first and second priority sort, you can expand it further as you wish, just replace the 0 with another comparison chain. Switch < and > or -1 and 1 for the reversed order.
someArray.sort(function(a,b) {
return a.item1 > b.item1 ? 1 : a.item1 < b.item1 ? -1 : a.item2 > b.item2 ? 1 : a.item2 < b.item2 ? -1 : 0;
});