AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
## times + [link](./times "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L13764 "View in source.") + [npm](https://www.npmjs.com/package/lodash.times "See the npm package.") ``` _.times(n, [iteratee=_.identity]) ``` 调用 iteratee N 次,每次调用返回的结果存入到数组中。 iteratee 会传入1个参数:(index)。 ### 参数 1. n (number) 要调用 `iteratee` 的次数 2. [iteratee=_.identity] (Function) 这个函数会处理每一个元素 ### 返回值 (Array) 返回调用结果的数组 ### 示例 ``` _.times(3, String); // => ['0', '1', '2'] _.times(4, _.constant(true)); // => [true, true, true, true] ```