I have an array of objects that looks like this:
[
{
"e_id": "1",
"total": 0
},
{
"e_id": "3",
"total": 0
}
]
Within a forEach loop, I want to increment the total
value depending on the e_id
. I have been trying something like this:
e.forEach((row) => {
this.arrayObj[row.e_id]['total']++;
});
But this does not work as I think it is using the e_id as an index as opposed to a reference.
Is there a way this can work?