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
2 Answers
+ 1
empty object literal used as initial value of reduce accumulator (obj argument of callback function)
10th Feb 2021, 6:54 AM
visph
visph - avatar
+ 1
Lokesh Rathi You posted same question twice delete that
10th Feb 2021, 8:32 AM
RšŸ’ šŸ‡®šŸ‡³
RšŸ’ šŸ‡®šŸ‡³ - avatar