Skip to content

Function: drop() ​

ts
function drop<T>(array, count): T[];

Drops the first N items from an array. 丢弃数组前 N 个元素。

Type Parameters ​

Type ParameterDescription
TThe type of array items / 数组元素类型

Parameters ​

ParameterTypeDescription
arrayreadonly T[]The source array / 源数组
countnumberThe 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

Released under the MIT License.