Preview:
function sum(a, b, c, d) {
    return a + b + c + d;
}

function curry(func) {
    return function (a) {
        return function (b) {
            return function (c) {
                return function (d) {
                    return func(a, b, c, d);
                }
            }
        }
    }
}

const add = curry(sum);

console.log(add(5)(9)(-4)(1))

OR

function curry(a) {
    return function (b) {
        return function (c) {
            return function (d) {
                return a + b + c + d
            }
        }
    }
}

console.log(curry(5)(9)(-4)(1))
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter