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); // => [] ```