var squares = new Array(); for(var i = 0; i <= 8; i++) { squares[i] = new Array(); for(var j = (i * 20) + 1; j <= 20 * i + 20; j++) if (squares[i] == null) squares[i] = j; else squares[i].push(j); }