Destructuring to get the last element of an array in es6 July 3, 2022 by Tarik console.log('last', [1, 3, 4, 5].slice(-1)); console.log('second_to_last', [1, 3, 4, 5].slice(-2));