function findMagicIndex(array, offset = 0) {
  if(!array || array.length === 0) {
    return -1;
  }

  const middle = parseInt(array.length/2);
  const index = middle + offset;

  if(index === array[middle]) {
    return index;
  } else if(index > array[middle]) {
    return findMagicIndex(array.slice(middle + 1), middle + 1);
  } else {
    return findMagicIndex(array.slice(0, middle), offset);
  }
}
O(log n) however, breaks with repeated values
@param array
@param offset
@returns {number}