Junior — Senior
Grouping and sorting transactions by years
livecode
Task condition
Implement a function that takes an array of transactions, sorts them by date, and creates an object where the keys are years and the values are arrays of dates in "MM-DD" format.
result = {
'2017': ['07-31', '08-22'],
'2018': ['01-01', '02-22'],
};
const operations = [
{ date: '2017-07-31', amount: '5422' },
{ date: '2017-08-22', amount: '5423' },
{ date: '2018-01-01', amount: '5422' },
{ date: '2018-02-22', amount: '5422' },
];