Первые n элементов

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