Array.prototype.copyWithinintermediateconst arr = [1, 2, 3, 4, 5]
arr.copyWithin(-2, 0, 2) // β [1, 2, 3, 1, 2]
// uses negative target indexUse negative indices with copyWithin() to reference positions from the end of the array.
Like other array methods, copyWithin supports negative indices. copyWithin(-1, 0, 1) copies the first element to the last position.
Challenge: Implement copyToEnd(arr) that copies the first element to the last position using arr.copyWithin(-1, 0, 1).
copyToEnd([1, 2, 3, 4]) // β [1, 2, 3, 1]
copyToEnd([9, 0, 0]) // β [9, 0, 9]