Here's an example function that takes an array and loops through its indexes in groups of 6:
index.tsx195 chars7 lines
Here's how you can use the function:
index.tsx98 chars3 lines
The output of the above code will be:
index.tsx53 chars4 lines
This function divides the array indexes into groups of 6 using a for loop and the slice()
method. Within each group, the map()
method is used to transform the array of values (which are taken from the original array using slice()
) into an array of indexes.
gistlibby LogSnag