DEV Community

loading...

Discussion on: How to convert an array into an object in javascript

Collapse
paritho profile image
Paul Thompson

So long as you don't have to support older browsers, or are using Babel, new ES features do this without the need of a helper function. See the MDN docs for Object.fromEntires.

Collapse
afewminutesofcode profile image
Aaron Author

Thanks Paul, I have done some reading on this feature a few months back but hadn't seen how I could apply this to my problem.

There is another comment from ygorbunkov which demonstrates how to do this so I will have a reference point if I need to use something similar again soon!