function binarySearch(arr, item) {
let low = 0;
let high = arr.length - 1;
while (low <= high) {
let mid = (low + high) >> 1;
if (arr[mid] < item) {
low = mid + 1;
} else if (arr[mid] > item) {
high = mid - 1;
} else {
return mid;
}
}
return -1;
}