code: function merge(left, right, compare) {
    var result = [];
    var leftIndex = 0;
    var rightIndex = 0;
  
    while (leftIndex < left.length || rightIndex < right.length) {
      if (leftIndex < left.length && rightIndex < right.length) {
        if (compare(left[leftIndex], right[rightIndex]) <= 0) {
          result.push(left[leftIndex++]);
        } else {
          result.push(right[rightIndex++]);
        }
      } else if (leftIndex < left.length) {
        result.push(left[leftIndex++]);
      } else if (rightIndex < right.length) {
        result.push(right[rightIndex++]);
      }
    }
    return result;
  }
docs: Merges two arrays in to a new array.
  @param {Array} left The first array.
  @param {Array} left The second array.
  @param {function} compare The compare function.
  @return The merged array.