A Pen By
Eric Feminella

` ````
// basic ES6 partial application implementation ...
const multiply = (x = 0, ...y) => {
if (y.length) {
return y.reduce((acc, curr) => {
return typeof curr === 'number' && (acc *= curr);
}, x);
}
return typeof x === 'number' && (i => x * i);
};
const log = console.log;
log(multiply(1, 10, 100));
log(multiply(1)(10));
log(multiply(1)(100));
log(multiply(1)(1000));
const multiplyBy10 = multiply(10);
const multiplyBy100 = multiply(100);
const multiplyBy1000 = multiply(1000);
log(multiplyBy10(1));
log(multiplyBy100(1));
log(multiplyBy1000(1));
```

999px

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Loading
..................

Alt
Opt
Find & Replace

Also see: Tab Triggers