last element of an arrayjs code example Example: last element of an array javascript var myArray = [1, 2, 3, 4]; myArray[myArray.length - 1];