update snippets 16-31
This commit is contained in:
committed by
Agamemnon Zorbas
parent
b2cffa6858
commit
014a77224c
@ -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
|
||||
*/
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user