Why does mapping onto an object only give me the last item? Below is the object displayed in the console:
0: {Transport: 2}
1: {Implementation: 9}
2: {Management: 3}
When I use ngFor, it only provides the last item
const obj = this.assigned_group;
// refined collection
const result = Object.values(
obj.reduce((c, v) => {
c[v] = c[v] || [v, 0];
c[v][1]++;
return c;
}, {})
).map((o) => ({ [o[0]]: o[1] }));
this.assigned_group_delta = result.map((a) => {
this.x = a;
});
console.log(this.x);
// The output only shows the last item in the object