Array.prototype.atintermediateconst arr = ['x', 'y', 'z']
arr[arr.length - 1] // β 'z' (bracket)
arr.at(-1) // β 'z' (at β cleaner)Prefer at() over bracket notation when accessing the last element β it avoids manual length arithmetic.
.at() can accept computed indices just like bracket notation. For an odd-length array, the middle element is at index Math.floor(arr.length / 2).
Challenge: Implement getMiddle(arr) that returns the middle element of an odd-length array using .at().
getMiddle([1, 2, 3, 4, 5]) // β 3
getMiddle([10, 20, 30]) // β 20