I have a multidimensional array which I would like to sort by two factors: First the state and then the city alphabetically.
var locations = [
['Baltimore', 'Maryland', 'MD'],
['Germantown', 'Maryland', 'MD'],
['Rockville', 'Maryland', 'MD'],
['San Francisco', 'California', 'CA'],
['San Diego', 'California', 'CA']
];
How can I sort them alphabetically based on these two factors?
First State, then City?
I know how to do it just be one factor, but not two..
1 Answer