This course has been updated! We now recommend you take the JavaScript: From First Steps to Professional course.

Check out a free preview of the full JavaScript: From Fundamentals to Functional JS, v2 course:
The "Currying" Lesson is part of the full, JavaScript: From Fundamentals to Functional JS, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Bianca introduces currying and composing. Currying is a process of using a function to gather arguments before passing them to another function.

Get Unlimited Access Now

Transcript from the "Currying" Lesson

[00:00:00]
>> Bianca Gandolfo: We're gonna talk about Reverend Green. Anything of note about Reverend Green?
>> Speaker 2: He likes green.
>> Bianca Gandolfo: He does like green.
>> Speaker 3: Religious?
>> Bianca Gandolfo: He's delicious?
>> Speaker 3: Religious [LAUGH].
>> Bianca Gandolfo: I was like okay.
>> Speaker 4: [LAUGH].
>> Bianca Gandolfo: [LAUGH] Yeah, he's religious. He's a suspect, same as Miss Scarlet, and also Professor Plum.

[00:00:27] So we're gonna be thinking about Professor Plum, and we're gonna be working on functional utility methods. In particular, we're gonna be talking about currying and composition, which are two fundamental concepts and or functional techniques.
>> Bianca Gandolfo: Let's check it out. So currying is when you create a function that can later be called multiple times with different arguments.

[00:01:02] And so, if you've notice that we have a, b, c.
>> Bianca Gandolfo: Right? So this function expects three arguments in order for it to return a value. So what curry does is that it allows you to call a function up to three times with these different values.
>> Bianca Gandolfo: Does that make sense?

[00:01:37] So for this a,b,c function. This curry returns a function. This function saves in scope somewhere this value, and then this value, and then this value, and once it hits it's third value, it returns the result. So that's what currying is, it just allows you to break up a larger function into,

[00:02:06]
>> Bianca Gandolfo: Or it allows you to break up arguments passed by the number of arguments. So that's currying, we're gonna implement our own version of currying, but before we do that I wanna talk about composing.