Array.prototype.fillbeginnerconst arr = [1, 2, 3, 4]
arr.fill(0) // β [0, 0, 0, 0]Use fill() without indices to replace every element with a single value.
Array.prototype.fill(value, start?, end?) fills all elements from start to end (exclusive) with a static value. Without start/end, it fills the entire array. The method mutates and returns the original array.
Challenge: Implement fillAll(arr, val) that fills the entire array with val using .fill(val).
fillAll([1, 2, 3], 0) // β [0, 0, 0]
fillAll([1, 2, 3], 'x') // β ['x', 'x', 'x']