Created
June 17, 2019 21:57
-
-
Save huyen-nguyen/e3bae4b5f3f4d0e1d0648b37648a27cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input: a stack | |
output: sum of all y0, y1, including data ({}) | |
for (let i = 0; i < stacks[0].length; i++){ | |
let point = []; | |
point[0] = stacks.reduce( | |
(accumulator, currentValue) => accumulator + currentValue[i][0],0); | |
point[1] = stacks.reduce( | |
(accumulator, currentValue) => accumulator + currentValue[i][1],0); | |
point.data = stacks[0][i].data; | |
total.push(point); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment