I have an array of objects.
Objects looks like this:
0: Object
_id: "555baa9a034de05173e9fee4"
name: "Smirnoff Vodka"
number: 120
priceQuantity: 195
subtotal: 195
taxes: Array[0]
Now, from all the objects, I have to calculate sum of amount of total sale of every time so that I know the total sale amount of every item. .
i.e push the values in these arrays
itemAmount=[];
itemName=[];
The array is going to be very large therefore I need it to be very efficient at the same time.
Also, before the total amount is calculated, I have to iterate over the taxes array so that to add all the taxes. What could be the efficient way to do it?