Каждый n-й элемент const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1);JavaScriptCopy const nthElement = (arr, n = 0) => (n === -1 ? arr.slice(n) : arr.slice(n, n + 1))[0];JavaScriptCopy everyNth([1, 2, 3, 4, 5, 6], 2); // [ 2, 4, 6 ]JavaScriptCopy nthElement(['a', 'b', 'c'], 1); // 'b' nthElement(['a', 'b', 'b'], -3); // 'a'JavaScriptCopy Браузер JavaScript