[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Statements/continue [Back]  [Original]

continue - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

continue

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 20157.

continue whiledo-whileforlabel

  • continue whiledo-whilefor break continue while for
  • continue label

continue

  1. continue
  2. continue label

In this article

1

continue while continue i 3 n 13712

js
i = 0;
n = 0;
while (i < 5) {
  i++;
  if (i == 3) continue;
  n += i;
}

2

checkiandj checkj continue checkj continue checkj false false checkiandj checkiandj false false checkiandj

continue checkiandj checkiandj

js
checkiandj: while (i < 4) {
  document.write(i + "<br/>");
  i += 1;
  checkj: while (j > 4) {
    document.write(j + "<br/>");
    j -= 1;
    if (j % 2 == 0) continue checkj;
    document.write(j + " is odd.<br/>");
  }
  document.write("i = " + i + "<br/>");
  document.write("j = " + j + "<br/>");
}

Web Proxy Viewer  |  New URL  |  Original Page