Answers for "get the second last index of array javascript"

34

last index array javascript

var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
Posted by: Guest on July-25-2019
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 the second last index of array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language