convert array of object to array 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: js convert array of arrays to array

// Converts array with multiple values into a single array with all items:
var merged = [].concat.apply([], arrays);

Example 3: how to convert object to array in javascript

const propertyValues = Object.values(person);

console.log(propertyValues);