I have the following array of objects:
const input = [
{ key1: 1, key2: 1, key3: 5 },
{ key1: 2, key2: 5, key3: 6 },
{ key1: 4, key2: 6, key3: 7 },
{ key1: 7, key2: 8, key3: 9 },
];
I just want to loop through an array of objects and collect all the values into a one dimensional array like this:
const output = [1, 1, 5, 2, 5, 6, 4, 6, 7, 7, 8, 9];
Can someone help solve this problem?
maporflatMapmethods useful ;) developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…inputonly has "one dimension"