Skip to content

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
See also  How to use lambda function in Python?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.