Home
Contact Us
Home
Contact Us
Home
Blogs
Get the last N elements of an Array in JavaScript
Get the last N elements of an Array in JavaScript
how to get the last n elements of an array in JavaScript.
const num= ["1", "3", "4", "7"]; const lastTwo = num.slice(-2);
Tags:
JavaScript
Share:
Search blog
Follow & Connect
Related posts
Remove empty elements from an array in Javascript
Deleting array elements in JavaScript - delete vs splice
Is it possible to sort elements of an array?
Copyright © 2025
datapearls.org