function extend(arr1, var_args) {
  for (let i = 1; i < arguments.length; i++) {
    const arr2 = arguments[i];
    if (goog.isArrayLike(arr2)) {
      const len1 = arr1.length || 0;
      const len2 = arr2.length || 0;
      arr1.length = len1 + len2;
      for (let j = 0; j < len2; j++) {
        arr1[len1 + j] = arr2[j];
      }
    } else {
      arr1.push(arr2);
    }
  }
}
Extends an array with another array, element, or "array like" object.
This function operates 'in-place', it does not create a new Array.

Example:
var a = [];
extend(a, [0, 1]);
a; // [0, 1]
extend(a, 2);
a; // [0, 1, 2]

@param {Array<VALUE>} arr1  The array to modify.
@param {...(IArrayLike<VALUE>|VALUE)} var_args The elements or arrays of
    elements to add to arr1.
@template VALUE