Last active
December 14, 2015 05:59
-
-
Save EpokK/5039463 to your computer and use it in GitHub Desktop.
Sort objects in an array alphabetically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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