如何将这些 for 语句转换为 JavaScript 中的 while 语句:
for (left = gridPlace; left <= gridLastPlace; left++){
for (right = gridOtherPlace; right <= gridLastOtherPlace; right++)
}
谢谢
最佳答案
A for (x; y; z) { ... }
与 x; 相同而 (y) { ... z; }
,所以你的循环将是:
left = gridPlace;
while (left <= gridLastPlace) {
right = gridOtherPlace;
while (right <= gridLastOtherPlace) {
...
right++;
}
left++;
}
关于javascript for to while 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9570854/