Skip to content
Advertisement

How to .reduce() an array that contains functions?

Lets say we have an array of functions

JavaScript

Is there a way to funcArray.reduce() and have all three functions apply on the string using reduce?

Advertisement

Answer

Compose is an HOC, which means it takes function and returns function. Trick is to decide when to execute the functions.

Here is a sample function that will work like redux’s compose

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement