function withLength(elems, length) {
  elems.length = length;
  return elems;
}
Returns an array with the given elements and length.
@param {!Array<T>} elems The elements in the array.
@param {number} length The length.
@return {!Array<T>} The original 'elems' array with its length changed.
@template T