function * chunk(iterable, maxSize) {
    let result = []
    for (const item of iterable) {
        result.push(item)
        if (result.length === maxSize) {
            yield result
            result = []
        }
    }
    if (result.length > 0) {
        yield result
    }
}

function * range(start, stop) {
    for (let i = start; i < stop; i++) {
        yield i
    }
}

function * enumerate(iterable) {
    let index = 0
    for (const item of iterable) {
        yield [index, item]
        index++
    }
}

for (const c of chunk(range(1, 100), 5)) {
    for (const [i, value] of enumerate(c)) {
        console.log(`index=${i} value=${value}`)
    }
    console.log('---')
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: