Created
March 31, 2015 04:32
-
-
Save adampats/d79971e054bb2b93745c to your computer and use it in GitHub Desktop.
javascript sort array of objects
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
objs.sort(function(a, b){ | |
return a.name == b.name ? 0 : +(a.name > b.name) || -1; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment