I have list of objects
[
{ regionName:'Alabama',code:'AL', value: 89 },
{ regionName:'Alaska',code:'AK', value: 112 },
{ regionName:'Arizona',code:'AZ', value: 101 },
{ regionName:'Arkansas',code:'AR', value: 123 }
]
which I want to convert to below format -
{
AL: { value: 89 },
AK: { value: 112 },
AZ: { value: 101 },
AR: { value: 123 }
}
How this can be achieved in JS?
value, why not just haveAL: 89? I'm guessing you will add to it later?