Return object directly from arrow function

This commit is contained in:
Alberto Restifo
2017-12-12 08:08:09 +01:00
committed by GitHub
parent b4781a478d
commit 8bc5c7800b

View File

@ -4,5 +4,5 @@ Use `map()` to create objects for each key-value pair, combine with `Object.assi
```js
var objectFromPairs = arr =>
Object.assign(...arr.map( v => {return {[v[0]] : v[1]};} ));
Object.assign(...arr.map( v => ({ [v[0]] : v[1] })));
```