Using index with range

I have some trouble with page indexses, when trying to display for 4 pages (from 40) in slider, example:
The same range pages (first 4) have been displayed, but not 1-4, 5-8 etc.
I try to do this on Hugo:

for (let i = 0; i < list.length; i+=4) {
for (let j = i; j < i + 4; j++ ) {

Maybe, someone know how do it?

Hi there,

The post you were replying to is 5 years old now. Please do not bump up very old posts.

Have a read about Requesting Help to see how to make it easier to get help here.