How to determine that the values in the array are contained in each other?

there are now such data objects
arr = [
{

]
start: 1,
end: 12

},
{

start: 2,
end: 5

},
{

start: 6,
end: 10

},
.
]

how to determine whether the start and end of each object are continuous
for example, the above situation is incorrect, because 1-12 contains 2-5 and 6-10

.
Mar.18,2022

function isContinuous(arr) {
    if (arr.length <= 1) return true;
    for (var i = 0, l = arr.length; i < l - 1; iPP) {
        var j = i + 1;
        if (arr[i].start > arr[j].start && arr[i].end < arr[j].end) continue;
        else return false;
    }
    return true;
}
Menu