times

v4.17.15arrow_drop_down
v4.17.15
v4.17.11
STATUS
Passing
DOWNLOADS
145
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
573 B
Invokes the iteratee `n` times, returning an array of the results of each invocation.
2 contributors
Install times as a package?
Copied
npm i @bit/lodash.lodash.times
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
times (
n:number,
iteratee:Function
) : Array

Invokes the iteratee n times, returning an array of the results of each invocation. The iteratee is invoked with one argument: (index).

Example
times(3, String)
// => ['0', '1', '2']

 times(4, () => 0)
// => [0, 0, 0, 0]
Arguments
n: number

The number of times to invoke iteratee.

iteratee: Function

The function invoked per iteration.

Returns
Array

Returns the array of results.

Help and resources