We dealt so far with functions tasked with extracting a value or a range of values from collections, and we will now move to functions that aggregate or transform collections. Aggregate functions operate over an entire collection to extract or calculate a single value or a limited set of values. Transformation functions operate over an entire collection and return a new collection that is usually a different representation of the original collection.
The first example of an aggregate function was _.reduce()
and the first example of a transformation function was _.map()
. The former calculates an accumulator value from the entire collection and the latter creates a new collection from the original collection.