I have a simple 2D array that I want to sort with two conditions.
[ [ "the,", 3 ], [ "who,", 3 ], [ "take,", 4 ], [ "over,", 4 ], [ "world,", 5 ] ]
Sort by number ascending
Then sort alphabetically descending
Expected result would be the who
word. First step is achieved with below code:
arraySorted = arrCom.sort((a, b) => a[1] - b[1] || a[0] - b[0]);