JavaScript Answers

How to convert object to array using JavaScript?

Spread the love

To convert object to array using JavaScript, we use the Object.values method.

For instance, we write

const arr = Object.values(inputObj);

to call Object.values with inputObj to return an array of the inputObj property values in it.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *