const arr = [1,2,3,4]; const last = arr[arr.length - 1]; console.log(last); // 4 const arr = [1,2,3,4]; const last = arr.at(-1); console.log(last); // 4 const arr = [1,2,3,4]; const last = arr.findLast(x => true); console.log(last); // 4