// this defines the label "outer"
outer: for (var x = 0; x < 10; x++) {
  // this for loop now has a label of "outer"
  for (var y = 0; y < 10; y++) {
    // this loop does not have a label
    const newElement = document.createElement("P");
    newElement.innerText = `${x}${y}`;
    document.body.appendChild(newElement);
    // we can break the inner loop early
    if (y === 5) break;
    // and thanks to the label, we can also break the outer loop early
    if (x === 5) break outer;
  }
  document.body.appendChild(document.createElement("HR"));
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.