Last active
December 27, 2019 20:19
-
-
Save awave1/f70cbaa15c02d6bdcb977b2d0ad197ef 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
function sum(arr, i, j) { | |
return arr.slice(i, j).reduce((prev, current) => current += prev, 0); | |
} | |
console.log(sum([1, 2, 3, 4, 5], 1, 3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment