Answers for "get the last index of array"

1

how to get last element of array

const lastItem = colors[colors.length - 1]
Posted by: Guest on April-19-2021
1

Get the last item in an array

if (loc_array[loc_array.length - 1] === 'index.html') {
   // do something
} else {
   // something else
}
Posted by: Guest on January-24-2021
0

js get last element of array

var arr = [1, 2, 3];
var last_element = arr.reverse()[0];
Posted by: Guest on August-09-2021

Code answers related to "get the last index of array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language