I have an array of objects as below;
{
'data': [{
value: 1000,
year: 1990
},
{
value: 1001,
year: 1990
},
{
value: 1002,
year: 1990
},
{
value: 1003,
year: 1991
},
{
value: 1004,
year: 1991
}
]
}
I want to convert the same to the one looks like below object
{
'1990': [{
value: 1000,
year: 1990
},
{
value: 1001,
year: 1990
},
{
value: 1002,
year: 1990
}],
'1991':[{
value: 1003,
year: 1991
},
{
value: 1004,
year: 1991
}
]
}
Is there any way for doing the same in Javascript or Angular 4?