var sum1 = arr.reduce(function(prev, next, index, array) { var a = [] return a.push(prev) ; }) var sum2 = arr.reduceRight(function(last, before, index, array) { var b = [] return b.push(last) }) function add1(arr1,arr2){ return a.concat(b) }