takeRight
最后更新于:2022-04-01 23:58:55
## takeRight
+ [link](./takeRight "Link to this entry.")
+ [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L6686 "View in source.")
+ [npm](https://www.npmjs.com/package/lodash.takeright "See the npm package.")
```
_.takeRight(array, [n=1])
```
从数组的结束元素开始提取 N 个数组
### 参数
1. array (Array)
需要处理的数组
2. [n=1] (number)
要提取的个数
### 返回值 (Array)
返回提取的元素数组
### 示例
```
_.takeRight([1, 2, 3]);
// => [3]
_.takeRight([1, 2, 3], 2);
// => [2, 3]
_.takeRight([1, 2, 3], 5);
// => [1, 2, 3]
_.takeRight([1, 2, 3], 0);
// => []
```
';