Create a new array of a specified length and fill it with a given value.
Time complexity: O(n)
Space complexity: O(n)
The length of the array
Value to fill the array with
The filled array
fill(3, 'a'); // ['a', 'a', 'a'] Copy
fill(3, 'a'); // ['a', 'a', 'a']
Array
Create a new array of a specified length and fill it with a given value.
Time complexity: O(n)
Space complexity: O(n)