Accumulated sum of arrays?

  node.js, question

HI, I have a requirement. Now I have an array

$old=[1,2,3]

Required output

$new=[1,3,6]

That is, each item n of the newly output array is the sum of the first n items (including n) of the corresponding old array. so, what is the best way?

Ps: The code should be elegant ~

var arr = [1, 2, 3, 4, 5];
 var newArr = [];
 arr.reduce(function (prev, next) {
 Push (prev plus next);
 Return prev plus next;
 }, 0);

Php finds the corresponding reduce method.