Get the array elements from the last element with JavaScript
We can use the array at
method to fetch the items from the last element of an array.
const arr = [1, 2, 3, 4]; console.log(arr.at(-3)); //2
We can use the array at
method to fetch the items from the last element of an array.
const arr = [1, 2, 3, 4]; console.log(arr.at(-3)); //2