Simply I want to assign x-coordinate and y-coordinate with for loops.But It is not working like another language like c#,c++.This is my code:
简单地说我想用for循环分配x坐标和y坐标。但它不像c#,c ++这样的另一种语言。这是我的代码:
var coordinate=[[]];
var x, y;
for (x=1; x <= 7; x += 1) {
for (y=1; y <= 5; y += 1) {
coordinate[x][y] = "("+x+","+y+")";
}
}
How can I make this?
我该怎么做?
1 个解决方案
#1
0
var coordinate=[];
var x, y;
for (x=1; x <= 7; x += 1) {
coordinate[x] = [];
for (y=1; y <= 5; y += 1) {
coordinate[x][y] = "("+x+","+y+")";
}
}
#1
0
var coordinate=[];
var x, y;
for (x=1; x <= 7; x += 1) {
coordinate[x] = [];
for (y=1; y <= 5; y += 1) {
coordinate[x][y] = "("+x+","+y+")";
}
}