Fish Wang says to YSITD function arrToObj(arr, key) { return arr.reduce(function (all, curr) { all[curr[key]] = curr; return all; }, {}) } in js