Javascript ES13 at() method
We may now retrieve array items in JavaScript using the at() method for arrays.
const arr = [1,2,3,4,5]
console.log(arr[1]) // output 2
console.log(arr.at(1)) // output 2
Positive and negative numbers are supported via the at() method of Array instances, which returns the item at the specified index. Negative integers count backwards from the array's last element.
const arr = [1,2,3,4,5]
console.log(arr[-2]) // output undefined
console.log(arr.at(-2)) // output 4
The at() method can retrieve the end of an array because its receiving parameter is a string.
arr.at(1) //output 2
arr.at("1") / /output 2