🔁loop

a statement that does something repeatedly.

JSstatement ⟩ loop

(statement) does something repeatedly.

👉 continue vs. break

(nested loop)

labeled statement is needed

  • when you want to skip to the next iteration of an outer loop that is not the nearest enclosing loop.

  • when you want to break out of a statement that is not the nearest enclosing loop / switch.

break/continue won't operate across an IIFE function boundary to control an outer loop/block.

📗 You Don't Know JS Yet: Scopes & Closrues

Last updated