Array.prototype.slicebeginnerconst arr = [1, 2, 3, 4, 5]
arr.slice(1, 4) // β [2, 3, 4] (indices 1, 2, 3)Use slice(start, end) to extract a sub-array without modifying the original.
Array.prototype.slice(start, end) returns a shallow copy of a portion of an array from start (inclusive) to end (exclusive). It does not mutate the original.
Challenge: Implement getSlice(arr, start, end) that returns arr.slice(start, end).
getSlice([1, 2, 3, 4, 5], 1, 3) // β [2, 3]
getSlice([10, 20, 30], 0, 2) // β [10, 20]