Skip to content

Instantly share code, notes, and snippets.

@joshmvandercom
Created May 9, 2011 22:04
Show Gist options
  • Save joshmvandercom/963526 to your computer and use it in GitHub Desktop.
Save joshmvandercom/963526 to your computer and use it in GitHub Desktop.
Case insensitive sort
// obviously this is for alpha
myArray.sort(function(x, y){
var xl = x.toLowerCase();
var yl = y.toLowerCase();
if (xl<yl) return -1;
if (xl>yl) return 1;
return 0;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment