Javascript Array Foreach Function Example Equation Combining