Последние n элементов

const lastN = (arr, n) => arr.slice(-n);
lastN(['a', 'b', 'c', 'd'], 2); // ['c', 'd']
Браузер JavaScript