function matrix(a,b) { var arr = [] for(i=0;i<a;i++) arr[i] = [] for(i=0,k=0;i<b;k++,i++) arr[i][k] = '' return arr } var m = matrix(8,8) alert(m[7][7])