In JS you would also need to check if the key exists first (so you can add it). I think the minimal example would be:
const groupByAge = {}
for (const person in people) {
if (!groupByAge[person.age]) {
groupByAge[person.age] = []
}
groupByAge[person.age].push(person)
}
IMO it is a very nice change to now be able to write: