Skip to content

initial

js
_.initial(array)

获取 array 中除最后一个元素之外的所有元素。

¥Gets all but the last element of array.

新增于

¥Since

0.1.0

参数

¥Arguments

  1. array (数组):要查询的数组。

    ¥array (Array): The array to query.

返回

¥Returns

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

¥(Array): Returns the slice of array.

示例

¥Example

js
_.initial([1, 2, 3]);
// => [1, 2]

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