I need to categorize an array based on a specific number (idGroup variable - integer) which is 3355 in this scenario. Below is the code I am using:
if (sortedReservationsByGroup['grouped'] === undefined) {
sortedReservationsByGroup['grouped'] = new Array();
}
if (sortedReservationsByGroup['grouped'][idGroup] === undefined) {
sortedReservationsByGroup['grouped'][idGroup] = new Array();
}
sortedReservationsByGroup['grouped'][idGroup].push(item);
}
This is how JavaScript executes it: