Build README
Also shorten syntax in objects from key-value pairs.
This commit is contained in:
@ -283,7 +283,7 @@ const timeTaken = (f,...args) => {
|
||||
Use `Array.reduce()` to create and combine key-value pairs.
|
||||
|
||||
```js
|
||||
const objectFromPairs = arr => arr => arr.reduce((a,b) => { a[b[0]] = b[1]; return a;}, {});
|
||||
const objectFromPairs = arr => arr => arr.reduce((a,b) => (a[b[0]] = b[1], a), {});
|
||||
```
|
||||
|
||||
### Powerset
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
Use `Array.reduce()` to create and combine key-value pairs.
|
||||
|
||||
```js
|
||||
const objectFromPairs = arr => arr => arr.reduce((a,b) => { a[b[0]] = b[1]; return a;}, {});
|
||||
const objectFromPairs = arr => arr => arr.reduce((a,b) => (a[b[0]] = b[1], a), {});
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user