Last active
November 30, 2016 14:20
-
-
Save szmeku/c2c96b10324c917394d569a7829d1215 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 reduce(func, acc, items){ | |
for(var i = 0; i<items.length; i++){ | |
acc = func(acc, items[i]); | |
} | |
return acc; | |
} | |
reduce(function(a, b){ return a+b; }, 0, [1,2,3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment