in merging process compare number of both array and push in new array and remove from original array. use while loop for this process.my wrong program is:
function mergeSortedArray(a, b){
var temp=[];
var i=0;
var j=0;
while(a[i]||b[j]){
if(a[i]<b[j]){
temp.push(a[i])
i++;
}
else{
temp.push(b[j]);
j++;
}
}
return temp;
}
console.log(mergeSortedArray([1,2,3,5,8],[1,2,4,6,9,10]));