javascript for to while statement



如何将这些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++;
}

相关内容

  • 没有找到相关文章

最新更新