Вариант
var arrOne = [0, 9, 10, 11, 12, 20, 28, 32, 33, 47, 65, 69],
arrTwo = [8, 14, 15, 16, 17, 18, 19, 31, 35, 36, 37, 58, 68, 73],
i = 0, j = 0;
while (i < arrOne.length) {
if(arrOne[i] < arrTwo[j]) {
while(arrOne[i + 1] < arrTwo[j]) { arrOne.splice(i, 1);}
i++; j++;
} else {
arrTwo.splice(j, 1);
}
}
alert(arrOne + '\n' + arrTwo);
|