var arr = [1,2,3,4,5]
getSums(arr) = [1, 1+2, 1+2+3, 1+2+3+4, more....]
var arr = [1,2,3,4,5]
function getSums(arr) {
let res = []
arr.reduce((sum, current) => {
res.push(sum+current)
return sum + current
},0)
return res
}
console.log(getSums(arr))