Function: drop()
ts
function drop<T>(array, count): T[];Drops the first N items from an array. 丢弃数组前 N 个元素。
Type Parameters
| Type Parameter | Description |
|---|---|
T | The type of array items / 数组元素类型 |
Parameters
| Parameter | Type | Description |
|---|---|---|
array | readonly T[] | The source array / 源数组 |
count | number | The number of items to drop / 要丢弃的数量 |
Returns
T[]
A new array without the dropped items / 丢弃后的新数组
Example
ts
drop([1, 2, 3, 4], 2)
// => [3, 4]Since
1.2.0