Last active
March 28, 2022 18:01
-
-
Save ryangoree/76fda064f59e8106f5ef115c7c841457 to your computer and use it in GitHub Desktop.
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
function groupStrings(strings) { | |
return Object.values(strings.sort().reduce((a, str) => { | |
const s = str.toLowerCase(); | |
const f = s[0]; | |
a[f] = a[f] ? [...a[f], s] : [s]; | |
return a; | |
}, {})); | |
} |
Author
ryangoree
commented
Mar 28, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment