Move item in an array, change the original array.
移动数组中的项,此方法会改变原数组。
The type of elements in the array / 数组元素的类型
the array / 数组
the index of the item to move. 要移动的项的索引
the index to move to. 要移动到的索引
the array with the item moved. 返回移动后的数组
This function mutates the original array in place using Array.prototype.splice. It does not create a copy.
Array.prototype.splice
此函数会通过 Array.prototype.splice 直接修改原数组,不会创建副本。
move([1, 2, 3], 0, 2) // => [3, 1, 2] Copy
move([1, 2, 3], 0, 2) // => [3, 1, 2]
Move item in an array, change the original array.
移动数组中的项,此方法会改变原数组。