Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[JavaScript] Labeled statement

A labeled statement can be used to exit a nested loop.

function loop () {
  dance: for (let i = 0; i < 4; i++) {
    for (let j = 0; j < 4; j++) {
      if (j === 2) break dance
    }
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *