Array.prototype.fillintermediateconst arr = [1, 2, 3, 4, 5]
arr.fill(7, 1, 4) // β [1, 7, 7, 7, 5]
// fills indices 1, 2, 3Use fill(value, start, end) to replace elements within a specific index range.
With all three arguments, fill(value, start, end) fills only the range [start, end) (end is exclusive). Elements outside this range are preserved.
Challenge: Implement fillRange(arr, val, start, end) that fills from start to end (exclusive) with val.
fillRange([1, 2, 3, 4, 5], 0, 1, 3) // β [1, 0, 0, 4, 5]
fillRange([1, 2, 3, 4, 5], 9, 2, 4) // β [1, 2, 9, 9, 5]