4 ms·
> The alternative is to use intermediate variables That's one alternative. Another alternative is to use a function to apply functions in readable order (whic
by dragonwriter 5y ago
> The alternative is to use intermediate variables
That's one alternative.
Another alternative is to use a function to apply functions in readable order (which effectively creates a context where “,” is the pipe operator.)
const pipe = (x, ...fns) => funs.reduce((acc, fn) => fn(acc), x);
- null_deref 5y agoIMO, I think this is far less readable than the pipe operator. Besides that how many times do you need to call three functions without additional parameters?
- dragonwriter 5y ago> I think this is far less readable than the pipe operator I agree that pipe is more readable. I didn't say it was a better alternative, just one that is available. > Besides that how many times do you need to call three functions without additional parameters? That...depends on programming style, quite a lot.