I am working with an array of daily data that looks like this:
var data = [{x: '2017-01-01', y: 100}, {x: '2017-01-02', y: 99}, /* entire year. */];
Each element in the array has an x field for date and a y field for a number. This array contains data for an entire year.
I am looking to generate an output array where each element is the sum of y values for every month, like so:
var output = [10000, 9999, ...]
I am unsure if JavaScript has a function similar to 'GROUP BY' in SQL. If it does, perhaps I can use a reduce method to accumulate data for each month. Can you please provide assistance?