last element from list javascript
snippet in c
last element of array javascript
user1445
var my_array = /* some array here */;
var last_element = my_array[my_array.length - 1];
get last item in array javascript
user1857
var colors = ["red","blue","green"];
var green = colors[colors.length - 1]; //get last item in the array
last element from list javascript
user4835
const lastItem = colors[colors.length - 1]