add number inside foreach code example Example: add number inside foreach total_amount += Number(amount);