I have an array of objects, which I want to sum by condition.
[{amount:100, prefix:'a'},{amount:50, prefix:'b'},{amount:70, prefix:'a'},{amount:100, prefix:'b'}]
Is there is a way to map the values, such as I will have two sums, one is 170, of prefix 'a', and one of 150 of prefix 'b'?