In my code, I have a Beverages array which has another array inside of it. When I open the Beverages array in console, I see the indexes. But, I want those indexes to be item names which is inside an item array (i attached screenshots). How can I see the array with item names instead of indexes?
TS:
forkJoin([this.items$, this.categories$]).subscribe(
([items, categories]: Array<any>) => {
const finalArray: Array<any> = [];
items.forEach((item: any) => {
let output = { item };
const foundCategory = categories.find(
(x) => x.id === item.categoryId
);
if (foundCategory) {
output = { output, ...foundCategory };
}
finalArray.push(output);
});
let grouped = [];
grouped = _.mapValues(_.groupBy(finalArray, (final) => final.name));
console.log(grouped);
// this.dataSource = finalArray;
// this.dataSource.paginator = this.paginator;
// this.dataSource.sort = this.sort;
}
);
enter image description here