curriculum/challenges/english/blocks/review-javascript-functional-programming/6723d2c154dd19d0025f7cd9.md
Here is an example of a regular function vs a curried function:
:::interactive_editor
// Regular function
function average(a, b, c) {
return (a + b + c) / 3;
}
console.log(average(2, 3, 4)); // 3
// Curried function
function curriedAverage(a) {
return function(b) {
return function(c) {
return (a + b + c) / 3;
};
};
}
console.log(curriedAverage(2)(3)(4)); // 3
:::
const curriedAverage = a => b => c => (a + b + c) / 3;
Review the JavaScript Functional Programming topics and concepts.