This course has been updated! We now recommend you take the Functional-Light JavaScript, v3 course.

Check out a free preview of the full Functional-Light JavaScript, v2 course:
The "Challenge 3: Compose and Pipe Utility" Lesson is part of the full, Functional-Light JavaScript, v2 course featured in this preview video. Here's what you'd learn in this lesson:

In this challenge, students code their own compose and pipe utilitiy.

Get Unlimited Access Now

Transcript from the "Challenge 3: Compose and Pipe Utility" Lesson

>> Kyle Simpson: So your exercise three is for you to make your own compose utility and pipe utility that can take any number of functions, not just two. Think about, before you even write that code, think about algorithmically, what would that look like? You could, for example, solve that with a loop.

[00:00:19] Where you have, you take your set of functions, you make it into an array, you loop over that array. And each time you call a function, you capture that output. And then that becomes the input to the next one. That's one way to do it. You could also do composition with recursion if you're more familiar with that.

[00:00:38] If you're not familiar with recursion, don't worry, later in the course we are going to dig into recursion in quiet a bit of detail. But if you want to try your hand at doing it with recursion, that's great. If you like list operations which again, we're going to get into later in the course, but if you already like list operations, you might want to do it as a reduce.

[00:00:55] So it's up to you, but I want you to take some time to play around with implementing a compose and a pipe. And think about what algorithm you're gonna use to do that before you write that code.