So, I've got a nice array like so:
["Mexico", "Belize", "Canada", "US"]
I want to sort it north-to-south.
I want:
["Canada", "US", "Mexico", "Belize"]
How to do this in javascript?
I have a preset of countries. I can tell Javascript "Hey, that array of countries I just gave you? Sort it Canada, US, Mexico, Belize."
This is for a static graphic, won't have to be dynamic, hard-coding OK.
I've got: my_array.sort() But I have no idea what to do next. Everything online seems to sort by number or alphabet.
And FWIW, list of countries is just an example. In real life, I'm trying to sort sources of government funding: state, federal, trust fund, tobacco settlement. But that's a pretty abstract question. Better to use something concrete like countries, no?