com-tools
Version:
com-tools 提供了一些通用的工具函数;
86 lines (40 loc) • 893 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [com-tools](./com-tools.md) > [moveItemInArray](./com-tools.moveiteminarray.md)
## moveItemInArray() function
移动数组的元素,会改变原数组
**Signature:**
```typescript
export declare function moveItemInArray<Item>(arr: Item[], from: number, to: number): Item[];
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
arr
</td><td>
Item\[\]
</td><td>
</td></tr>
<tr><td>
from
</td><td>
number
</td><td>
</td></tr>
<tr><td>
to
</td><td>
number
</td><td>
</td></tr>
</tbody></table>
**Returns:**
Item\[\]
原数组对象
## Remarks
将数组中的元素 从 from 移动到 to