function binaryInsert(arr, element, comparator) {
    const index = binarySearch(arr, element, comparator);
    const insertionPoint = index < 0 ? -(index + 1) : index;
    arr.splice(insertionPoint, 0, element);
}
Searches the array for the target using binary search, returns the index
of the found element, or position to insert if element not found. If no
comparator is specified, elements are compared using array_
util.defaultComparator, which is suitable for Strings and Numbers in
ascending arrays. If the array contains multiple instances of the target
value, the left-most instance will be returned.
@param arr The array to be searched in.
@param target The target to be searched for.
@param comparator Should take 2 arguments to compare and return a negative,
   zero, or a positive number.
@return Lowest index of the target value if found, otherwise the insertion
   point where the target should be inserted, in the form of
   (-insertionPoint - 1).