update snippets 16-31

This commit is contained in:
Stefan Feješ
2017-12-25 14:05:36 +01:00
committed by Agamemnon Zorbas
parent b2cffa6858
commit 014a77224c
15 changed files with 70 additions and 30 deletions

View File

@ -7,10 +7,11 @@ The last (rightmost) function can accept one or more arguments; the remaining fu
```js
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)));
/*
```
```js
const add5 = x => x + 5
const multiply = (x, y) => x * y
const multiplyAndAdd5 = compose(add5, multiply)
multiplyAndAdd5(5, 2) -> 15
*/
```