function splice(arr, index, howMany, var_args) {
  asserts.assert(arr.length != null);

  return Array.prototype.splice.apply(arr, slice(arguments, 1));
}
Adds or removes elements from an array. This is a generic version of Array
splice. This means that it might work on other objects similar to arrays,
such as the arguments object.

@param {IArrayLike<T>} arr The array to modify.
@param {number|undefined} index The index at which to start changing the
    array. If not defined, treated as 0.
@param {number} howMany How many elements to remove (0 means no removal. A
    value below 0 is treated as zero and so is any other non number. Numbers
    are floored).
@param {...T} var_args Optional, additional elements to insert into the
    array.
@return {!Array<T>} the removed elements.
@template T