Published on August 29th, 2019
Let’s say you array of elements similar to this one, and you want to get last 3 elements from it.
const array = ['first', 'second', 'third', 'fourth', 'fifth']
.splice array method.
const last3 = array.splice(-3, 3) // ['third', 'fourth', 'fifth']
And that’s it! So easy!