Category
Create a new array of a specified length and fill it using the given function.
Time complexity: O(n)
Space complexity: O(n)
A function that returns each value to fill the array with
The length of the array
The filled array
mapFill(i => i + 1, 3); // [1, 2, 3] Copy
mapFill(i => i + 1, 3); // [1, 2, 3]
Array
Create a new array of a specified length and fill it using the given function.
Time complexity: O(n)
Space complexity: O(n)