last elemnt of an array in js code example
Example 1: last element of array javascript
var my_array = /* some array here */;
var last_element = my_array[my_array.length - 1];
Example 2: access index of array javascript
let first = fruits[0]
// Apple
let last = fruits[fruits.length - 1]
// Banana