about function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 Answer
+ 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