As I mentioned in the title, I have a list of JavaScript objects which has following structure:
[
{value: 1, date: timestamp},
{value: 1, date: timestamp + 1},
{value: 0, date: timestamp + 2}
]
Is there a way to skip every object with the same value as previous one? Value can only be either 1 or 0. I was thinking about some mix of filter or reduce/compare.
The result would be as follows:
[
{value: 1, date: timestamp},
{value: 0, date: timestamp + 2}
]