.times(n, [iteratee=.identity])
Invokes the iteratee n
times, returning an array of the results of each invocation. The iteratee is invoked with one argument; (index).
Since
0.1.0
Arguments
n
(number): The number of times to invokeiteratee
.[iteratee=.identity]
(Function)_: The function invoked per iteration.
Returns
(Array): Returns the array of results.
Example
_.times(3, String);// => ['0', '1', '2']_.times(4, _.constant(0));// => [0, 0, 0, 0]
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .