I\'m using Javascript sort (with Underscore.js):
sort
_.sortBy([\"Bob\", \"Mary\", \"Alice\"], function (name) {return name}) > [\"Alice\", \"Bob\", \
You can do this with a 1 liner in ES6, just change the > depending on the direction you want.
>
.sort() is supported since IE6 and you just pass a function which returns 1 or -1;
.sort()
["Bob", "Mary", "Alice].sort((a, b) => a > b ? 1 : -1);