I am facing a challenge with an array of objects structured as shown below:
[
{
"e_id": "1",
"total": 0
},
{
"e_id": "3",
"total": 0
}
]
My objective is to increment the total
value in a forEach loop based on the e_id
. I have attempted the following approach:
e.forEach((row) => {
this.arrayObj[row.e_id]['total']++;
});
Unfortunately, this method does not seem to be effective because it seems to use the e_id as an index rather than a reference. Any idea how to make this work?