Solution for Rosetta Code: Accumulator factory

What is your hint or solution suggestion?
Arrow notation => can be used to express a function instead of function demo(){} Since we are embedding a function inside a function, there are two arrows, and the final operation is adding all the numbers into a cumulative sum number.

Solution 1

var accumulator = sum => (n => sum += n);

Challenge: Accumulator factory

Link to the challenge: