I've taken on a challenging puzzle to solve. I have a multi-dimensional array in my Javascript code that is structured like this; Each feature is defined by an ID, a date (in string format), and a state.
Here's an example:
Features = [
[1, "20200503", "Active"],
[2, "20200503", "Closed"],
[2, "20200503", "Closed"],
[2, "20200502", "Closed"],
[2, "20200501", "Active"],
[2, "20200430", "Active"],
[2, "20200430", "Active"],
[3, "20200503", "New"],
[3, "20200502", "New"],
];
My goal is to condense this array into a new one with the following result;
Features = [
[1, 1, "Active"],
[2, 3, "Closed"],
[2, 3, "Active"],
[3, 2, "New"],
];
I'm looking to perform a distinct operation based on the ID and state while counting the occurrences of each date.
Is it feasible to achieve this using Javascript?