Adding previous value with current one in array

I have an array of numbers and I want to add the numbers and return an array of addition value
My Array looks like

var optionYPos:Array=new Array(0,10,20,40);

I want the result as
0,10,30,70

Just adding the previous value with the current one.

Please help me with this