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 1: Purify a Function" 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 purify a function by creating a pure function named “bar” to wrap around the function “foo.”

Get Unlimited Access Now

Transcript from the "Challenge 1: Purify a Function" Lesson

[00:00:00]
>> Kyle Simpson: So I want you to practice with those two techniques. Exercise one gives you an impure function. First step, make a wrapper around it. Make a bar wrapper around the impure food that contains all of the side effects. It passes in any context it needs. Captures any outputs, returns the outputs that are necessary.

[00:00:22] Here's a hint, if you need to return multiple outputs, which you will, a nice, convenient way of doing that is return them as an array.