update snippets 16-31

This commit is contained in:
Stefan Feješ
2017-12-25 14:05:36 +01:00
parent 5e1b9b2b7d
commit 1835d4894d
15 changed files with 66 additions and 27 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
*/
```