Convert an array of objects to array of the objects' values Convert an array of objects to array of the objects' values arrays arrays

Convert an array of objects to array of the objects' values


As order of values in array returned by Object.values() isn't guaranteed, you should consider use of .map() with some Object Destructuring. You can then extract object properties in separate variables and return them in desired order explicitly.

const data = [  { amount: '100', user: 'admin', date: 'March 6, 2019' },  { amount: '120', user: 'admin', date: 'March 6, 2019' },  { amount: '80',  user: 'admin', date: 'March 7, 2019' },  { amount: '200', user: 'admin', date: 'March 7, 2019' }];const result = data.map(({ amount, user, date }) => [amount, user, date]);console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }