Returns an iterable that uses a function that generates values a given number of times.
Time complexity: O(n)
Space complexity: O(n)
A function that returns each value to fill the array with
The number of times to repeat the value
An iterable that repeats value times number of times
value
times
Iterable
[...mapRepeat((increment) => increment ** 2, 5)]; // [0, 1, 4, 9, 16] Copy
[...mapRepeat((increment) => increment ** 2, 5)]; // [0, 1, 4, 9, 16]
Returns an iterable that uses a function that generates values a given number of times.
Time complexity: O(n)
Space complexity: O(n)