Array.prototype.fillintermediateconst arr = [1, 2, 3, 4, 5]
arr.fill(0, -3) // β [1, 2, 0, 0, 0]
// fills the last 3 elementsUse a negative start index with fill() to fill elements counting from the end.
fill() supports negative indices for start and end. fill(val, -2) fills the last two elements of the array.
Challenge: Implement fillLastTwo(arr, val) that fills the last 2 elements of arr with val using arr.fill(val, -2).
fillLastTwo([1, 2, 3, 4, 5], 0) // β [1, 2, 3, 0, 0]
fillLastTwo([10, 20], 99) // β [99, 99]