I would like that this code:
var arr = [
{ key: 'foo', val: 'bar' },
{ key: 'hello', val: 'world' }
];
var result = arr.map((i) => ([i.key]: i.val)); //something like this
console.log(result);
Returns:
{foo: 'bar', hello: 'world'}
Is this possible in ECMA6?