0

Here is my array:

var arr = [
  ['ABC', '01/01/2016', '000000001'],
  ['ABC', '02/01/2016', '000000002'],
  ['ABC', '03/01/2016', '000000003'],
  ['DEF', '01/01/2016', '000000004'],
  ['DEF', '02/01/2016', '000000005'],
  ['DEF', '03/01/2016', '000000006'],  
];

First I want to sort it by second column DESC and then by first column ASC to get this:

var arr = [
  ['ABC', '03/01/2016', '000000003'],
  ['DEF', '03/01/2016', '000000006'],  
  ['ABC', '02/01/2016', '000000002'],
  ['DEF', '02/01/2016', '000000005'],
  ['ABC', '01/01/2016', '000000001'],
  ['DEF', '01/01/2016', '000000004'],
];

Is that possible? I found here only examples that allow to sort one direction. The third column can be a combination of first and second (if that helps to sort)

3
  • 1
    Take a look at stackoverflow.com/questions/6993302/… Commented Jan 18, 2017 at 20:02
  • What have you tried? What code did you write? And last of all what do you want to achieve? Commented Jan 18, 2017 at 20:02
  • Thank you Snowmonkey... It works Commented Jan 18, 2017 at 20:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.