Skip to main content


Showing posts with the label Currying

Making Curry in Javascript

In this post, we will try to understand Currying in Javascript, how we can make curry function and the reason behind the currying concept. What is Currying in Javascript? Currying is the process of taking a function with multiple arguments and turning it into a sequence of functions each with a single argument and eventually resolve to a value. Not clear with the definition,right? Lets understand with example, in which we have written a function to find the volume. // volume function definition using arrow const volume = (l, b, h) => (l * b * h);  // calling volume function volume(3,2,4);   // 24 Learn about arrow functions, here . Now here, when we want to call this volume function, we need to pass all the three arguments at one time. Consider a scenario where you get length, breadth and  height at different part of the function or javascript file. How can we achieve this? To answer such scenario, we can use currying in javascript. Making curry function