adding numbers using foreach loop javascript code example Example: add number inside foreach total_amount += Number(amount);