Created
March 1, 2016 20:46
-
-
Save mralexho/01e139460fc40097b15e to your computer and use it in GitHub Desktop.
Alpha sort
This file contains 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
myArr.sort(function(a, b) { | |
var aName = a.text.toLowerCase(); | |
var bName = b.text.toLowerCase(); | |
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment