find last element in array nodejs

const arr = ['apple', 'banana', 'cherry']; const lastElement = arr[arr.length - 1]; console.log(lastElement);