get the last element from array javascript code example
Example 1: javascript get last element of array
var foods = ["kiwi","apple","banana"];
var banana = foods[foods.length - 1];
Example 2: how to get last element of array
return array[array.length - 1];
Example 3: javascript last element of array
let arr = ['a', 'b', 'c']
arr.slice(-1)[0]
Example 4: javascript get last element of array
Yo an add that was searching this up, is where I found the chrome extension.
Example 5: javascript get last element of array
var name = ["jon","tem","kevin", "ramos"];
var lastNameInArray = name[name.length - 1];
Example 6: javascript take last element of array
let array = [1,2,3,4,5];
let lastElement = array.pop();