1ar sum = 0;
2 for (var i = Math.min(...arr); i <= Math.max(...arr); i++) {
3 sum += i;
4 }
1function sumAll(arr) {
2 let fullArr = [];
3 let sum = 0;
4 const reducer = (accumulator, currentValue) => accumulator + currentValue;
5 arr.sort(function(a, b) {
6 return a - b
7 });
8 for (let i = arr[0]; i <= arr[1]; i++) {
9 fullArr.push(i);
10 }
11 sum = fullArr.reduce(reducer);
12 return sum;
13}