I have an array of objects:
[{person:101, year: 2012}, {person:102, year: 2012}, {person:103, year: 2013}]
And I want to be able to return an aggregate count for each year (much like a group by in SQL would achieve) in the format of:
[{year: 2012, count:2}, {year: 2013, count:1}]
What is the best way to achieve this in Vanilla Javascript?