Skip to content
Advertisement

Convert object to an array of objects?

I have an object that looks like this:

JavaScript

and I need to convert it to an array of objects that would look like this:

JavaScript

What would be the cleanest & efficient way to do this?

Advertisement

Answer

You can use .map() with Object.keys():

JavaScript

Useful Resources:

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