n values produced using provided function.
repeat(3, () => 'yes') Copy
repeat(3, () => 'yes')
repeat(5, Math.random) Copy
repeat(5, Math.random)
Yields
n values produced using provided function.
Example
Example