> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/array/initial.md).

# \_.initial（去除最后一个元素）

**语法：**

```javascript
_.initial(array)
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L7476)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.initial)

**描述：**

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

> 去除数组`array`中的最后一个元素

**开始版本：**&#x30;.1.0

**参数：**

* `array (Array)`: 要查询的数组。

**返回值：**

* `array (Array)`: 返回截取后的数组。

**例子：**

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