const isSingleInterval = (intervals) => {
const sortedIntervals = intervals.sort(([a], [b]) => a - b);
const [first, ...rest] = sortedIntervals;
const mergedIntervals = [first];
rest.forEach((element) => {
const current = mergedIntervals[mergedIntervals.length - 1];
if (element[0] <= current[1]) {
current[1] = Math.max(current[1], element[1]);
} else {
mergedIntervals.push(element);
}
});
return mergedIntervals.length === 1;
};
validationButtonForme(titleCard, linkImage, popupButtonAdd);
() => {
if (inputOne.value.length && inputTwo.value.length) {
enbableButton(button2);
} else {
disabledButton(button2);
}
}
validationButtonForme(titleCard, linkImage, popupButtonAdd)();
const randomMix = array => {
const mixer = (arr, res = []) => {
if (arr.length === 0) return res;
const randomIndex = Math.floor(Math.random() * arr.length);
const newRes = arr.splice(randomIndex, 1)
return mixer(arr, [...res, ...newRes])
}
return array.map(arr => mixer(arr))
}