var
startx = 0,
starty = 0,
endx = 12,
endy = 100;
for(startx;startx <= endx; startx+=1){
for(starty; starty <= endy; starty+=1){
console.log(startx, endx, starty, endy);
}
}
Run Code Online (Sandbox Code Playgroud)
预期产量:
0, 12, 0, 100
0, 12, 1, 100
0, 12, 2, 100
...
0, 12, 100, 100
1, 12, 0, 100
1, 12, 1, 100
...
12, 12, 100, 100
;EOO
Run Code Online (Sandbox Code Playgroud)
Chrome 39+上的输出
0, 12, 0, 100
0, 12, 1, 100
0, 12, 2, 100
...
0, 12, 100, 100
Run Code Online (Sandbox Code Playgroud)
所以问题是第一个for循环不会遍历startx变量. …
javascript ×1