Skip to content

slice

js
_.slice(array, [start=0], [end=array.length])

创建从 startend(但不包括)的 array 的一个切片。

¥Creates a slice of array from start up to, but not including, end.

注意:使用此方法代替 Array#slice 来确保返回密集数组。

¥Note: This method is used instead of Array#slice to ensure dense arrays are returned.

新增于

¥Since

3.0.0

参数

¥Arguments

  1. array (数组):要切片的数组。

    ¥array (Array): The array to slice.

  2. [start=0] (数值):要大写的字符串。

    ¥[start=0] (number): The start position.

  3. [end=array.length] (数值):结束位置。

    ¥[end=array.length] (number): The end position.

返回

¥Returns

(数组):返回 array 的切片。

¥(Array): Returns the slice of array.

Lodash v4.17 中文网 - 粤ICP备13048890号