I have a array of objects:
const arr = [
{
name: "Name 1",
symbol: "S1"
},
{
name: "Name 2",
symbol: "S2"
},
]
And I want to transform this on this
{
S1: "Name 1", S2: "Name 2"
}
I tried this
arr.map((a) => { [a.symbol]: a.name })
But no luck. How can I achieve this?