Updated snippets

Mainly for better readability
This commit is contained in:
Angelos Chalaris
2017-12-12 18:21:53 +02:00
parent 67beb3b785
commit 4967ef8931
5 changed files with 12 additions and 14 deletions

View File

@ -3,6 +3,6 @@
Use `Array.reduce()` to create and combine key-value pairs.
```js
const objectFromPairs = arr => arr.reduce((a,b) => (a[b[0]] = b[1], a), {});
const objectFromPairs = arr => arr.reduce((a,v) => (a[v[0]] = v[1], a), {});
// objectFromPairs([['a',1],['b',2]]) -> {a: 1, b: 2}
```