Example

```
const sum = x => y => x + y;
/* returns the number 3. 1st round of parameter are x, the second round are y*/
console.log(sum (2)(1));
// returns a function y => 2 + y
console.log(sum (2));
```

```
3
y => 2 + y
```

Javascript has First-Class Functions

```
const addPartial = x =>
(y,z) => add(x,y,z);
const add5 = addPartial(5);
const sum = add(5,6,7);
```

`18`

The same as:

```
const addPartial = (x,y) =>
z => add(x,y,z);
const add5and6 = addPartial(5,6);
const sum = add5and6(7);
console.log(sum);
```

`18`

and also as:

```
const addPartial = x =>
y => z => add(x,y,z);
const add5 = addPartial(5);
const add5and6 = add5(6);
const sum = add5and6(7)
console.log(sum);
```

`18`

And even more weird:

```
const addPartial = x =>
y => z => add(x,y,z);
const sum = addPartial(5)(6)(7);
console.log(sum);
```

`18`

This type of programming is currying.

Sources:

https://www.linkedin.com/learning/learning-functional-programming-with-javascript-es6-plus/currying-and-partial-application

https://medium.com/front-end-weekly/javascript-es6-curry-functions-with-practical-examples-6ba2ced003b1