I have:
arrayBefore
arrayBefore = [{name:'n1', items: [i1]}, {name:'n2', items: [i2]}, {name:'n1', items: [i3]}]
I want to create a function:
myFunction
myFunction(arrayBefore)
So it will produce:
arrayAfter
arrayAfter = [{name:'n1', items: [i1, i3]}, {name:'n2', items: [i2]}]
I have tried to implement myFunction using map() and filter(), but I can't get it working correctly. I would show some code I tried if I had the idea I was getting close, unfortunatly this is not the case. Any help would be greatly appreciated!