Returns every n-th element of the sequence, starting with the first.
Type of elements within the source iterable.
The source iterable.
Positive interval indicating how many elements to skip between yielded items.
A deferred sequence containing elements whose zero-based index is divisible by step.
Thrown when step is less than 1.
source is enumerated exactly once; elements that are not yielded are still visited to honour the stepping interval.
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];const stepped = step(numbers, 3).toArray();console.log(stepped); // [1, 4, 7] Copy
const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];const stepped = step(numbers, 3).toArray();console.log(stepped); // [1, 4, 7]
Returns every n-th element of the sequence, starting with the first.