0

Have array of collection, which I need to merge as one collection [ { "Score": 38 }, { "Age": 6 } ];

I need to convert this to {"Score": 38,"Age": 6} so that I can process easily.

Please provide the way to process this.

Striker
  • 61
  • 1
  • 9
  • Check the following MDN docs on the spread syntax in object literals: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#spread_in_object_literals `[{"Score": 38}, {"Age": 6}].reduce((a, c) => ({ ...a, ...c}), {})` – Steve Sep 09 '22 at 03:44

0 Answers0