多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 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] ```