Last active
June 12, 2018 09:34
-
-
Save alfredayibonte/26c22b5729006c6c8cf79b83286888fe to your computer and use it in GitHub Desktop.
demonstrating javascript reduce by calculating total cost and total revenue
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
initialValue | selling_price | cost_price | quantity | accumulator.TotalCost | accumulator.TotalRevenue | |
---|---|---|---|---|---|---|
0 | 20 | 5 | 4 | 20 | 80 | |
- | 25 | 5 | 10 | 70 | 330 | |
- | 10 | 10 | 2 | 90 | 350 | |
- | 15 | 15 | 8 | 210 | 470 | |
- | 20 | 5 | 4 | 230 | 550 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment