Skip to main content
1 of 2
Tyler
  • 41
  • 2

summing of individual numbers in an array in javascript

Im trying to add up all the numbers in each array and print out the total sum of that array. im not sure how to get this code done.

example:

var myArray = [123, 456, 789]

I want the program to print out 6,15,24.

since 1+2+3 = 6 , 4+5+6=15 and 7+8+9= 24.

how would i go about adding each individual number in that array?

Tyler
  • 41
  • 2