I have an array of time slots
[
{
startTime: "13:00",
endTime: "15:00"
},
{
startTime: "17:00",
endTime: "20:00"
}
]
and I have a time slot from the user -
const timeSlot = {
startTime: '16:00',
endTime: '18:00'
}
I want to check if there's any collision/overlapping of time slots before adding it to the array. What is the most optimal way to do this?