I want to remove any objects from my array that have a matching start and end property in reverse order.
const arr = [
{ start: 'Nebraska', end: 'Kentucky' },
{ start: 'Montana', end: 'New York' },
{ start: 'Wyoming', end: 'California' },
{ start: 'California', end: 'Wyoming' },
{ start: 'New Hampshire', end: 'Ohio' },
]
i.e., if these two objects exist in the array
{ start: 'Wyoming', end: 'California' },
{ start: 'California', end: 'Wyoming' }
I want to remove
{ start: 'California', end: 'Wyoming' }
I feel like reduce is the way to go for this solution, but not quite sure how to implement it. Any advice is appreciated