what should i do to convert an array to an object?

You can use Array.map and Object.fromEntries to convert the final result to the object you want.

  .reduce((a, b) => a.reduce((r, v) => r.concat(b.map((w) => [].concat(v, w))), []))
  .map((v) => Object.fromEntries(v.map((sv, sk) => [`custom${sk + 1}`, sv])));

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top