'How to sort an array based on the second value with javascript? [duplicate]
I have an array:
[
[0, 'Please select a Customer'],
[2072, 'S-Customer'],
[834, '01-Customer'],
[709, 'C-Customer'],
[4217, 'Test'],
[2074, 'A-Customer']
]
but how can I sort it numeric and alphabetically and still have the same ID which is the first value?? It would be like this:
obs: the first value should not be changed.
[
[0, 'Please select a Customer'],
[834, '01-Customer'],
[2074, 'A-Customer'],
[709, 'C-Customer'],
[2072, 'S-Customer'],
[4217, 'Test']
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|