Created
December 18, 2024 13:30
-
-
Save yamamoto-works/2929e5e252e9881cd9c01e9d85eecf74 to your computer and use it in GitHub Desktop.
groupBy (javascript)
This file contains hidden or 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
result = Object.groupBy([ | |
{country: "jp", city: "Tokyo", name: "Ymamamoto"}, | |
{country: "jp", city: "Osaka", name: "Yoshida"}, | |
{country: "ko", city: "seoul", name: "Kim"}, | |
{country: "ko", city: "busan", name: "zai"}, | |
{country: "cn", city: "shanhai", name: "cho"}, | |
], ({country})=> country) | |
console.log(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment