I have the following array
data = [
{ name: 'foo', type: 'fizz', val: 9 },
{ name: 'boo', type: 'buzz', val: 3 },
{ name: 'bar', type: 'fizz', val: 4 },
{ name: 'car', type: 'buzz', val: 7 },
];
How do I make it
{
9: 'foo',
3: 'boo,
4: 'bar',
7: 'car'
}
in ES6.
Thanks in advance!!