Closed jrhorn424 closed 8 years ago
In ruby, inject can be remembered because the operator (or block) is "injected" between items in the enumerable.
inject
In JavaScript, we can remember reduce since it takes a set of many items and "reduces" them to a single value. For example:
reduce
var sum = function sum (a, b) { return a + b; }; [1,2,3].reduce(sum,0) //=> 6
This language is incorporated into the reduce section of the readme @jrhorn424 if you'd like to close
Thanks @laurenfazah!
In ruby,
inject
can be remembered because the operator (or block) is "injected" between items in the enumerable.In JavaScript, we can remember
reduce
since it takes a set of many items and "reduces" them to a single value. For example: