I am looking to create a skip pattern that can be applied to an array. The goal is to select the starting point of the pattern within the array and then return the items based on that pattern.
For instance, if I want to skip 2 2 1 2
in the array arr = [1,2,3,4,5,6,7,8,9]
, starting from the second item (2), it should return [2,4,6,7,9]
. Does anyone have insight into how this can be achieved using JavaScript?