1var numbers = [3, 5, 7, 2];
2var sum = numbers.reduce((x, y) => x + y);
3console.log(sum); // returns 17
4
5// other way
6
7x = sumAll(1, 123, 500, 115, 44, 88);
8
9function sumAll() {
10 var i;
11 var sum = 0;
12 for (i = 0; i < arguments.length; i++) {
13 sum += arguments[i];
14 }
15 return sum;
16}