Skip to main content
Tidied title; grammar; layout.
Source Link
Tushar
  • 87.4k
  • 21
  • 164
  • 182

summing Summing of individual numbers in an array in javascriptJavaScript

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

exampleExample:

var myArray = [123, 456, 789]

var myArray = [123, 456, 789]

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

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

howHow would iI go about adding each individual number in that array?

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?

Summing of individual numbers in an array in JavaScript

I'm trying to add up all the numbers in each array and print out the total sum of that array. I'm 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?

Source Link
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?