Created
September 22, 2022 21:58
-
-
Save Ivannnnn/48b2fc5a1ee9fe36c09d2c847178c7b3 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
const group = (arr, func) => | |
arr.reduce((acc, val) => { | |
(acc[func(val)] = acc[func(val)] || []).push(val); | |
return acc; | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment