3 ms·const foo = bar.reduce((hash, item) => { hash[item.id] = item; return hash; }, {});by keville 5y agoconst foo = bar.reduce((hash, item) => { hash[item.id] = item; return hash; }, {});