I'm making a sports court booking system and have have an array of booking objects. There are 3 courts that can be booked.
array = [
{start: "12:00", end: "13:00", court:1},
{start: "10:00", end: "11:00", court:1},
{start: "12:00", end: "13:00", court:2},
{start: "15:00", end: "16:00", court:3},
{start: "12:00", end: "13:00", court:3}
]
What would be the best way to find the common start and end values that exists for all 3 courts?
The return value I'm looking for would be something like: [{start: '12:00', end: '13:00'}]
This question seems to be getting at a similar problem, but couldn't figure out a way to make it work in my case