object of objects to array js code example
Example 1: javascript object to array
//ES6 Object to Array
const numbers = {
one: 1,
two: 2,
};
console.log(Object.values(numbers));
// [ 1, 2 ]
console.log(Object.entries(numbers));
// [ ['one', 1], ['two', 2] ]
Example 2: object to array javascript
Object.values(obj)
Example 3: js convert obj to array
const array = [
['key', 1],
['two', 2],
];
Object.fromEntries(array);
// { one: 1, two: 2 }