Created
February 28, 2018 10:49
-
-
Save haingdc/16c27421a8ba5bbacc234329ee29833f to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 2
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
var reduce = function(callback, initialValue, array) { | |
var output = initialValue; | |
for (var i = 0; i < array.length; i = i + 1) { | |
output = callback(output, array[i]); | |
} | |
return output; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment