add item to arrey inside foreach code example
Example 1: add number inside foreach
total_amount += Number(amount);
Example 2: how to append item to an array in foreach javascript
for (var i = 0; i < a.length; i++) {
if (a[i] == 1) a.push(5);
console.log(a[i]);
}