I have a data like this:
const input = [ {title: 'head', value: a, amount: 10},
{title: 'head', value: b, amount: 5},
{title: 'body', value: c, amount: 20} ];
I want to make an array of object literals with data like this:
const output = [{title: 'head',
values: [{value: a, amount: 10},
{value: b, amount: 5}]
},
{title: 'body',
values: [{value: a, amount: 20}]
}];
since I'm not used to javascript, I'm having trouble wrapping values by title.
plz help me.