Removes the item at fromIndex from source and inserts it into target at toIndex. Both arrays are mutated in place.
fromIndex
source
target
toIndex
The item type.
The array to remove from.
Zero-based index of the item to remove from source.
The array to insert into.
Zero-based index at which to insert into target.
const src = ['a', 'b', 'c'];const tgt = ['x', 'y'];moveItemToArray(src, 1, tgt, 1);// src → ['a', 'c']// tgt → ['x', 'b', 'y'] Copy
const src = ['a', 'b', 'c'];const tgt = ['x', 'y'];moveItemToArray(src, 1, tgt, 1);// src → ['a', 'c']// tgt → ['x', 'b', 'y']
Removes the item at
fromIndexfromsourceand inserts it intotargetattoIndex. Both arrays are mutated in place.