I have this;
let subs = [];
for ( const item of items ) { // array
for ( const sub of item ) { // array
subs.push( sub );
}
}
and want the same result with this (version 2):
const arr = Object.values(items).map(item =>
item.map(sub => sub)
);
However, in version 2, I get for each "item" a array of "subs" instead of one array holding all "subs" (like in version 1). I need something like "flatMap". Or how can I do that?