Что сложного?
var arr1 = [1, 3, 5, 7];
arr2 = [2, 6, 10];
var counter1 = 0;
counter2 = 0;
counter3 = 0;
counter4 = 0;
counter5 = (arr1.length + arr2.length) / 2;
endCounter = 0;
totalCounter = 0;
for(; totalCounter < Math.round(counter5); totalCounter++){
counter4 = counter3;
if(arr1[counter1] <= arr2[counter2]) {
counter3 = arr1[counter1];
counter1++;
} else {
counter3 = arr2[counter2];
counter2++;
};
};
if(counter5 != Math.round(counter5)){
endCounter = (counter3 + counter4) / 2;
} else {
endCounter = counter3;
};