js for循环

for (let i = 0; i < 3; i++) {
  console.log(i);
}

let i = 0;
for (;;) {
  if (!(i < 3)) {
    break;
  }
  console.log(i);
  i++;
}

添加label

end: for (let i = 0; i < 10; i++) {
  for (let j = 0; j < 3; j++) {
    if (i === 2) break end;
    console.log(i + j);
  }
}
posted @ 2020-08-23 12:37  Ajanuw  阅读(141)  评论(0编辑  收藏  举报