Answers for "get last few elements in array javascrpt"

1

return last two values of array in javascript

arr.slice(Math.max(arr.length - 5, 1))
Posted by: Guest on March-01-2020
0

javascript get second last element of array

const numbers = ["one", "two", "three", "four"];
console.log(numbers[numbers.length - 2]);
Posted by: Guest on September-06-2020

Code answers related to "get last few elements in array javascrpt"

Code answers related to "Javascript"

Browse Popular Code Answers by Language