I'm attempting to organize reservations based on business ID in order to achieve a specific end result. Here is the desired output:
[ [businessID1] => [Object1,Object2, Object3], [businessID2] => [Object1,Object2], [businessID3] => [Object1,Object2] ]
Below is the code I am currently using:
let groups = new Array;
this.reservations.map(function (value) {
groups[value.businessID] = value;
});
However, this approach is not working as expected because it keeps overwriting the array key. As someone new to the TypeScript/JavaScript world, any guidance or suggestions would be greatly appreciated.