const array = [1, 2, 3, 4];
array.slice(-1)[0];

으로 하면 코드중복없이 깔끔하게 뽑아올 수 있다.