主题
drop
js
_.drop(array, [n=1])创建 array 的一个切片,其中从开头删除了 n 个元素。
¥Creates a slice of array with n elements dropped from the beginning.
新增于
¥Since
0.5.0
参数
¥Arguments
array(数组):要查询的数组。¥
array(Array): The array to query.[n=1](数值):要删除的元素数。¥
[n=1](number): The number of elements to drop.
返回
¥Returns
(数组):返回 array 的切片。
¥(Array): Returns the slice of array.
示例
¥Example
js
_.drop([1, 2, 3]);
// => [2, 3]
_.drop([1, 2, 3], 2);
// => [3]
_.drop([1, 2, 3], 5);
// => []
_.drop([1, 2, 3], 0);
// => [1, 2, 3]