The problem here is that you are doing the ranges wrong. the javascript slice function cuts the array into the interval [start,finish), and by that I mean that it does not include the end index in the new array
So you shoudl change this:
} else if (newList[halfNum] < number) {
newList = newList.slice(halfNum + 1,newList.length - 1);
} else {
newList = newList.slice(0,halfNum - 1);
}
To this:
} else if (newList[halfNum] < number) {
newList = newList.slice(halfNum + 1,newList.length);
} else {
newList = newList.slice(0,halfNum);
}