I have this type of array.
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
Requirements to filter the array are
- Omit every 4 items
- Take the following 4 items
And continue until the end of the array.
At the end It should return [5,6,7,8,13,14,15,16,21,22,23,24]
>Solution :
const values = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24];
newValues = values.filter((v, i) => i % 8 > 3)
console.log(newValues)