Simplify objectFromPairs

This commit is contained in:
Siarhei
2018-09-07 17:46:58 +04:00
parent d0247e91a3
commit d47cdf3e3d
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ Creates an object from the given key-value pairs.
Use `Array.reduce()` to create and combine key-value pairs.
```js
const objectFromPairs = arr => arr.reduce((a, v) => ((a[v[0]] = v[1]), a), {});
const objectFromPairs = arr => arr.reduce((a, [key, val]) => ((a[key] = val), a), {});
```
```js