Answers for "how to find running sum in array javascript"

2

javascript array of cumulative sum

const accumulate = arr => arr.map((sum => value => sum += value)(0));

// Example
accumulate([1, 2, 3, 4]);   // [1, 3, 6, 10]
// 1             = 1
// 1 + 2         = 3
// 1 + 2 + 3     = 6
// 1 + 2 + 3 + 4 = 10
Posted by: Guest on July-02-2020

Code answers related to "how to find running sum in array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language