Skip to content
Advertisement

How do i convert an array of objects to objects of objects?

I have an array of objects

JavaScript

Sample output

JavaScript

I tried this way but did not get the correct keys, not sure how do i get proper keys in ascending order.

JavaScript

Advertisement

Answer

Use Object.assign

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement