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

# \_.dropRight(结尾丢掉n个元素)

**语法：**

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

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

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

**描述：**

创建一个切片数组，去除array结尾的n个元素。（n默认值为1。）

**开始版本：**&#x33;.0.0

**参数：**

* `array (Array)`: 需要处理的数组。
* `[size=1] (number)`: 每个块的长度。&#x20;

**返回值：**

* `array (Array)`: 返回新的块数组。

**例子：**

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

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

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

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