How do I create array of array from array of object? Currently I am using javascript but the result is different. I believe there is a bug.
var income = [
{"_credit": {“category”: “drinks”}, “debit_amount”:200},
{"_credit": {“category”: “drinks”}, “debit_amount”:400},
{"_credit": {“category”: “drinks”}, “debit_amount”:500},
]
var newIncome = [];
for (var i = 0; i < income.length; i++) {
newIncome.push([income[i]._credit.category, “”, income[i].debit_amount]);
};
And the result that I get is
[[drinks, 1100], [drinks, 400], [drinks, 500]],
The first array will sum up all the amount.