企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 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); // => [] ```