re: What Can Array Folding Do? VIEW POST

re: I don't understand the pipe one, can you explain it better, or at least say examples of usage? Ty.

The pipe takes in an array of functions and "connects" them so that the output of a function within that array is passed as an input to the function after it.

const squareThenIncrement = pipe([x => x * x, x => x + 1])
squareThenIncrement(4);  // 17
squareThenIncrement(9);  // 82

There are a few medium articles out there explaining it in more detail. I didn't want to make this post too detailed. I just wanted to show how much we could do using just that fold function

code of conduct - report abuse