Skip to content

Instantly share code, notes, and snippets.

@EpokK
Last active December 14, 2015 05:59
Show Gist options
  • Save EpokK/5039463 to your computer and use it in GitHub Desktop.
Save EpokK/5039463 to your computer and use it in GitHub Desktop.
Sort objects in an array alphabetically
objArray.sort(function(a, b) {
var textA = a.DepartmentName.toUpperCase();
var textB = b.DepartmentName.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment