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(; //2
See also  Python code snippet - How to set a foreign key field value to current user django rest framework?

Leave a Reply

Your email address will not be published. Required fields are marked *

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