You have an array of objects and want to reduce them to a value, similar to Ruby's
You can simply use Array's
reduceRight() methods along with an anonymous function, keeping the code clean and readable. The reduction may be something simple such as using the
+ operator with numbers or strings.
Or it may be something more complex such as aggregating elements from a list into a combined object.
reduceRight in version 1.8. Coffeescript provides a natural and simple way to express anonymous functions. Both go together cleanly in the problem of merging a collection's items into a combined result.