1//#Source https://bit.ly/2neWfJ2
2const every_nth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1);
3console.log(every_nth([1, 2, 3, 4, 5, 6], 1));
4console.log(every_nth([1, 2, 3, 4, 5, 6], 2));
5console.log(every_nth([1, 2, 3, 4, 5, 6], 3));
6console.log(every_nth([1, 2, 3, 4, 5, 6], 4));
7
8