for hours i\'ve been trying to figure out how to sort 2 array dependently.
Let\'s say I have 2 arrays.
First one:
array1 = [\'zzzzz\', \'aaaa
I would "zip" them into one array of objects, then sort that with a custom sort callback, then "unzip" them back into the two arrays you wanted:
var array1 = ['zzzzz', 'aaaaaa', 'ccccc'], array2 = [3, 7, 1], zipped = [], i; for(i=0; i
Here's a working fiddle.