如何将这些for语句转换为javascript:中的while语句
for (left = gridPlace; left <= gridLastPlace; left++){
for (right = gridOtherPlace; right <= gridLastOtherPlace; right++)
}
感谢
for (x; y; z) { ... }
与x; while (y) { ... z; }
相同,因此循环为:
left = gridPlace;
while (left <= gridLastPlace) {
right = gridOtherPlace;
while (right <= gridLastOtherPlace) {
...
right++;
}
left++;
}
var left = gridPlace;
while(left <= gridLastPlace)
{
var right = gridOtherPlace;
while(right <= gridLastOtherPlace)
{
right++;
}
left++;
}