Created
January 28, 2020 14:31
-
-
Save tommylinks/8c3641b1873a9a05b9b1e71e15027593 to your computer and use it in GitHub Desktop.
Sort array by firstname (alphabetically) in Javascript
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
const users = ["c", "a", "b"] | |
users.sort((a, b) => a.localeCompare(b)) // ["a", "b", "c"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment