DEV Community

Fatima Alam
Fatima Alam

Posted on

JavaScript: Currying Function

function outsideFunction(num1){
    let acc = num1;
    return function innerFunction1(num2){
        acc+=num2;
        return function innerFunction2(num3){
            acc+=num3;
            return  acc;
        }
    }
}

outsideFunction(1)(2)(3);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)