Fills elements of an array with a specified value from the start index up to, but not including, the end index.
The array to fill.
The value to fill the array with.
The start position (inclusive). Defaults to 0.
0
The end position (exclusive). Defaults to the array length.
A new array with the specified range filled with the given value.
fill([1, 2, 3, 4], 0, 1, 3);// → [1, 0, 0, 4]fill([1, 2, 3], 5);// → [5, 5, 5] Copy
fill([1, 2, 3, 4], 0, 1, 3);// → [1, 0, 0, 4]fill([1, 2, 3], 5);// → [5, 5, 5]
1.0.0
Fills elements of an array with a specified value from the start index up to, but not including, the end index.