I have a set of data similar to this:
[{fecha: '01/06/2018', pago: '30', id: '-LDviH9T9XripkL64-8y'}, {fecha: '02/06/2018', pago: '20', id: '-LDviH9T93spkL64-8y'}].
How could I group the elements by months and add the totals? For example:
[50,20,40,50,20,40,40,20,12,21]
Let each element be the total of the month. This is my code:
totalEgreso2() {
return this.$store.getters.getCargarCheckIn.reduce(function (total, item, index, array){
return total + item.pago
},{})