javascript get the last array element

JavaScript
const myArray = [1, 2, 3]

console.log(myArray.item(-1))
//=> 3
Source

Also in JavaScript: