function equals(arr1, arr2, opt_equalsFn) {
  if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) ||
      arr1.length != arr2.length) {
    return false;
  }
  const l = arr1.length;
  const equalsFn = opt_equalsFn || defaultCompareEquality;
  for (let i = 0; i < l; i++) {
    if (!equalsFn(arr1[i], arr2[i])) {
      return false;
    }
  }
  return true;
}
Compares two arrays for equality. Two arrays are considered equal if they
have the same length and their corresponding elements are equal according to
the comparison function.

@param {IArrayLike<A>} arr1 The first array to compare.
@param {IArrayLike<B>} arr2 The second array to compare.
@param {?function(A,B):boolean=} opt_equalsFn Optional comparison function.
    Should take 2 arguments to compare, and return true if the arguments
    are equal. Defaults to {@link goog.array.defaultCompareEquality} which
    compares the elements using the built-in '===' operator.
@return {boolean} Whether the two arrays are equal.
@template A
@template B