How to convert object to array using JavaScript?

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.