Implement a function fill(array, value, start = 0, end = array.length) that fills elements of an array with a specified value from start index up to, but not including, end index.
array: The array to modify.value: The value to fill the array with.start (optional): Start index (inclusive). Defaults to 0.end (optional): End index (exclusive). Defaults to array.length.Example
fill([1, 2, 3, 4], 0); // [0, 0, 0, 0] fill([1, 2, 3, 4], 5, 1, 3); // [1, 5, 5, 4]
JavaScript Function
No test results yet
Click "Run" to execute tests