_.reduceRight

reduceRight_.reduceRight(list, iteratee, memo, [context]) Alias: foldr
The right-associative version of reduce. Foldr is not as useful in JavaScript as it would be in a language with lazy evaluation.

var list = [[0, 1], [2, 3], [4, 5]];
var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
=> [4, 5, 2, 3, 0, 1]
doc_Underscore
2016-04-09 09:05:24
Comments
Leave a Comment

Please login to continue.