Showing posts with label reduce. Show all posts
Showing posts with label reduce. Show all posts

Friday, November 29, 2013

Two Approaches To Using Lodash Reduce

The Lodash reduce() function is an elegant way to reduce your collections down to a single result. For example, to sum an array of numbers, to apply a more elaborate formula to a specific property on a collection of objects, etc. I've found myself using two different approaches with _.reduce() — both have their upsides.