Is it possible to sort and reorder an array that looks like this:
itemsArray = [ ['Anne', 'a'], ['Bob', 'b'], ['Henry', 'b'], ['Andrew', 'd'], ['Jason', 'c'], ['Thomas', 'b'] ]
to match the location of this array:
sortingArr = [ 'b', 'c', 'b', 'b', 'a', 'd' ]
Sorry, I donβt have tracking identifiers. I will need to move the items array so that it matches the Arr sort as close as possible.
Update:
Here is the result I'm looking for:
itemsArray = [ ['Bob', 'b'], ['Jason', 'c'], ['Henry', 'b'], ['Thomas', 'b'] ['Anne', 'a'], ['Andrew', 'd'], ]
Any idea how this can be done?
javascript
user1448892 Nov 09 '12 at 8:29 2012-11-09 08:29
source share