diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.english.md
index 0b83fbcb70..0fb12bd216 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/avoid-mutations-and-side-effects-using-functional-programming.english.md
@@ -63,6 +63,10 @@ console.log(fixedValue); // Should print 4
arity
of a function is the number of arguments it requires. Currying
a function means to convert a function of N arity
into N functions of arity
1.
In other words, it restructures a function so it takes one argument, then returns another function that takes the next argument, and so on.
Here's an example:
-
//Un-curried function+
function unCurried(x, y) {
return x + y;
}
//Curried function
function curried(x) {
return function(y) {
return x + y;
}
}
curried(1)(2) // Returns 3
//Un-curried functionThis is useful in your program if you can't supply all the arguments to a function at one time. You can save each function call into a variable, which will hold the returned function reference that takes the next argument when it's available. Here's an example using the
function unCurried(x, y) {
return x + y;
}
//Curried function
function curried(x) {
return function(y) {
return x + y;
}
} +
//Alternative using ES6 +
const curried = x => y => x + y +
+
curried(1)(2) // Returns 3
curried
function in the example above:
// Call a curried function in parts:Similarly,
var funcForY = curried(1);
console.log(funcForY(2)); // Prints 3
partial application
can be described as applying a few arguments to a function at a time and returning another function that is applied to more arguments.
@@ -65,6 +69,6 @@ add(10)(20)(30);