我有两个号码范围。假设第一个愤怒是6-9,第二个是1-15
我需要检查它是否存在冲突。我的意思是,如果1-15跨越6-9,有效范围是1-5,10-15,但像这样的1-15,2-18应该会返回我它违反了6-9。
目前我只检查信号数字,如果它在范围内,
if (typeof (Number.prototype.isBetween) === "undefined") {
Number.prototype.isBetween = function (min, max, notBoundaries) {
var between = false;
if (notBoundaries) {
if ((this < max) && (this > min)) between = true;
alert('notBoundaries');
} else {
if ((this <= max) && (this >= min)) between = true;
alert('Boundaries');
}
alert('here');
return between;
}
}但现在我需要检查一下范围。任何帮助我们都将不胜感激
https://stackoverflow.com/questions/41378372
复制相似问题