function insert(start, deleteCount, elements) {
    var deleteEnd = start + deleteCount,
        elementCount = elements ? elements.length : 0,
        index = start - 1,
        length = start + elementCount,
        object = this,
        result = [],
        tail = slice.call(object, deleteEnd);

    // delete elements from the array
    while (++index < deleteEnd) {
      if (index in object) {
        result[index - start] = object[index];
        delete object[index];
      }
    }
    // insert elements
    index = start - 1;
    while (++index < length) {
      object[index] = elements[index - start];
    }
    // append tail elements
    start = index--;
    length = (object.length >>> 0) - deleteCount + elementCount;
    while (++index < length) {
      if ((index - start) in tail) {
        object[index] = tail[index - start];
      } else {
        delete object[index];
      }
    }
    // delete excess elements
    deleteCount = deleteCount > elementCount ? deleteCount - elementCount : 0;
    while (deleteCount--) {
      delete object[length + deleteCount];
    }
    object.length = length;
    return result;
  }
Utility function used by `shift()`, `splice()`, and `unshift()`.
@private
@param {Number} start The index to start inserting elements.
@param {Number} deleteCount The number of elements to delete from the insert point.
@param {Array} elements The elements to insert.
@returns {Array} An array of deleted elements.