last element of array javascript
snippet in javascript

last element of array javascript

user5581

var my_array = /* some array here */;
var last_element = my_array[my_array.length - 1];

javascript last item in array

user1986

// Find the last item in an array.

arrayName[arrayName.length - 1]

last element of array javascript

user1177

var my_array = /* some array here */;
var last_element = my_array[my_array.length - 1];

last element of array javascript

user8262

if (loc_array[loc_array.length - 1] === 'index.html') {
   // do something
} else {
   // something else
}

last element of array javascript

user2589

last element of array