update snippets 78 - 96
This commit is contained in:
committed by
Agamemnon Zorbas
parent
c829ed692e
commit
9ef34b7392
@ -6,5 +6,8 @@ Use `Array.reduce()` to create and combine key-value pairs.
|
||||
|
||||
```js
|
||||
const objectFromPairs = arr => arr.reduce((a, v) => (a[v[0]] = v[1], a), {});
|
||||
// objectFromPairs([['a',1],['b',2]]) -> {a: 1, b: 2}
|
||||
```
|
||||
|
||||
```js
|
||||
objectFromPairs([['a',1],['b',2]]) -> {a: 1, b: 2}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user