Sum Them All
Calcule the sum of an array off integers. For example, if numbers = [3, 13, 4, 11, 9], the sum is 40.
Complete the function arraySum in the editor below. The function must return the integer sum of the numbers array.
arraySum has the following parameter(s):
number[numbers], ...numbers[n-1]]: an array of integers
. 1 <= n <= 10^4
. 1 <= numbers[i] < = 10^4
Input from stdin will be processed as follows and passed to the function.
The first line contains an integer n, the size of the array numbers.
Each of the next n lines contains an integer numbers[i] where 0 <= i<= n.
Please stop posting your homework here. Try to post stuff your proud of rather than everything you do :)
Ohhh okay just a thought. I think if you created a global variable, looped through the object/array using
for...in and then take the global variable and add it to the next value of the array it will most likely work :D