code: function sort(array, compare, swap) {
    for (var i = 0; i < array.length - 1; i++) {
      for (var j = 1; j < array.length - i; j++) {
        if (compare(array, j - 1, j) > 0) {
          swap(array, j, j - 1);
        }
      }
    }
    return array;
  }
docs: Sorts an array using bubble sort.
  @param {Array} array The array to sort.
  @param {function} compare The compare function.
  @param {function} swap A function to call when the swap operation is
  performed. This can be used to listen in on internals of the algorithm.
  @returns The sorted array.