The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Advanced Reduce: Flatten, Flatmap and ReduceRight

Advanced Reduce: Flatten, Flatmap and ReduceRight

8:06
Learn a few advanced reduction patterns: flatten allows you to merge a set of arrays into a single array, the dreaded flatmap allows you to convert an array of objects into an array of arrays which then get flattened, and reduceRight allows you to invert the order in which your reducer is applied to your input values.
Watch this lesson now
Avatar
egghead.io

Learn a few advanced reduction patterns: flatten allows you to merge a set of arrays into a single array, the dreaded flatmap allows you to convert an array of objects into an array of arrays which then get flattened, and reduceRight allows you to invert the order in which your reducer is applied to your input values.

Avatar
Wesley

For the last example, we could use reverse with join

[1, 2, 3, 4, '5'].reverse().join('')

[1, 2, 3, 4, 5].reverse().join('')

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?