Join Slack
Powered by
hey, any idea how to get an output like {accName1 ...
# getting-started
f
flat-nest-33539
03/31/2023, 10:50 AM
hey, any idea how to get an output like {accName1 => id1, accName2 => id2} with this snippet?
Untitled
flat-nest-33539
03/31/2023, 10:52 AM
i’m trying to achieve an equivalent of this
Untitled
b
bright-air-36771
04/01/2023, 12:51 PM
I might be wrong but couldn't you do this in the map? (Haven't tested it)
Copy code
export const accountIds = accounts.map(k => {k.name: k.id})
bright-air-36771
04/01/2023, 12:51 PM
Map always generates an array so i'm not sure if that's what you wanted
2
Views
Open in Slack
Previous
Next