0

about function

function groupById(array) { return array.reduce((obj, value) => { obj[value.id] = value; return obj; }, {}) } i want to known after return obj; {}) what is this?

10th Feb 2021, 6:41 AM
Lokesh Rathi
Lokesh Rathi - avatar
1 Antwort
+ 1
empty object literal used as initial value of reduce accumulator (obj argument of callback function)
10th Feb 2021, 6:55 AM
visph
visph - avatar