function moveItem(arr, fromIndex, toIndex) {
  asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
  asserts.assert(toIndex >= 0 && toIndex < arr.length);
  // Remove 1 item at fromIndex.
  const removedItems = Array.prototype.splice.call(arr, fromIndex, 1);
  // Insert the removed item at toIndex.
  Array.prototype.splice.call(arr, toIndex, 0, removedItems[0]);
  // We don't use goog.array.insertAt and goog.array.removeAt, because they're
  // significantly slower than splice.
}
Moves one item of an array to a new position keeping the order of the rest
of the items. Example use case: keeping a list of JavaScript objects
synchronized with the corresponding list of DOM elements after one of the
elements has been dragged to a new position.
@param {!IArrayLike<?>} arr The array to modify.
@param {number} fromIndex Index of the item to move between 0 and
    `arr.length - 1`.
@param {number} toIndex Target index between 0 and `arr.length - 1`.