function compare3(arr1, arr2, opt_compareFn) {
  const compare = opt_compareFn || defaultCompare;
  const l = Math.min(arr1.length, arr2.length);
  for (let i = 0; i < l; i++) {
    const result = compare(arr1[i], arr2[i]);
    if (result != 0) {
      return result;
    }
  }
  return defaultCompare(arr1.length, arr2.length);
}
3-way array compare function.
@param {!IArrayLike<VALUE>} arr1 The first array to
    compare.
@param {!IArrayLike<VALUE>} arr2 The second array to
    compare.
@param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
    function by which the array is to be ordered. Should take 2 arguments to
    compare, and return a negative number, zero, or a positive number
    depending on whether the first argument is less than, equal to, or
    greater than the second.
@return {number} Negative number, zero, or a positive number depending on
    whether the first argument is less than, equal to, or greater than the
    second.
@template VALUE