> 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/take.md).

# \_.take（数组截取）

**语法：**

```javascript
_.take(array, [n=1])
```

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

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

**描述：**

创建一个数组切片，从`array`数组的起始元素开始提取`n`个元素。

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

**参数：**

* `array (Array)`: 要检索的数组。
* `[n=1] (number)`: 要提取的元素个数。

**返回值：**

* `(Array)`: 返回 array 数组的切片（从起始元素开始n个元素）。

**例子：**

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

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

_.take([1, 2, 3], 5);
// => [1, 2, 3]

_.take([1, 2, 3], 0);
// => []
```
