Готовое решение с for:
var arr = [],
step = 5, // offset between choosen positions
size = 11; // grid size ~ 11x11
for(i = 0; i < size; i++) { // fill array
arr.push([]);
var str = '';
for(j = 0; j < size; j++) {
arr[i][j] = i * size + j;
str+=addZero(''+arr[i][j], 3)+', ';
}
console.log(str); // draw array
}
for( i = 0 ; i + size * step < arr.length * size; i+=step) { // use ' i+=step' to start from last X pos (ex. 0-1, 1-2), else use ' i+=step+1' to reduce repetition (ex. 0-1, 2-3)
var row = Math.floor(i / size),
column = Math.floor(i % size);
if( row == Math.floor((i + step) / size) && row % step == 0) {
console.log(
'-----'+
arr[row][column]+","+
arr[row][column + step]+","+
arr[row + step][column]+","+
arr[row + step][column + step]
);
}
}
function addZero(str,length) { // add 0 to fill str length
while(str.length < length) {
str = '0'+str;
}
return str;
}