code: function sort(array, compare) {
    if (array.length <= 1) {
      return array;
    }
  
    var i;
    var middle = Math.floor(array.length / 2);
    var left = new Array(middle);
    var right = new Array(array.length - middle);
  
    for (i = 0; i < left.length; i++) {
      left[i] = array[i];
    }
    for (i = 0; i < right.length; i++) {
      right[i] = array[i + left.length];
    }
  
    return merge(sort(left, compare), sort(right, compare), compare);
  }
docs: Sorts an array using top down merge sort.
  @param {Array} array The array to sort.
  @param {function} compare The compare function.
  @returns The sorted array.