continue
In JavaScript, the continue keyword skips the rest of the current pass of a loop and moves on to the next pass. In a while or do...while loop, it jumps to the condition check. In a for loop, it jumps to the update expression, and in for...of and for...in loops, it moves to the next value or key. To leave the loop entirely, code uses break instead.
A continue can also name a label, which is an identifier and a colon placed before a loop. The continue label; form starts the next pass of that outer loop and abandons the inner loop. Unlike break, continue works only inside loops, and its label must name a loop, not a block. Labels aren’t keywords, and the label must be on the same line as continue.
A continue can’t cross a function boundary, so one inside a callback, such as the function passed to .forEach(), is a SyntaxError.
JavaScript continue Keyword Syntax
A continue statement can appear with or without a label:
continue;
continue <label>;
JavaScript continue Keyword Examples
A continue statement skips the rest of the loop body for blank names:
> const names = ["Ada", "", "Grace", " "];
undefined
> for (const name of names) {
… if (name.trim() === "") {
… continue;
… }
… console.log(`Hello, ${name}!`);
… }
Hello, Ada!
Hello, Grace!
undefined
Blank names skip the greeting, and the loop moves on to the next item.
With a label, continue moves on to the next pass of the outer loop:
> const orders = { ada: [5, 12], grace: [-3, 8], alan: [7] };
undefined
> customers: for (const customer in orders) {
… for (const amount of orders[customer]) {
… if (amount < 0) {
… continue customers;
… }
… }
… console.log(`${customer} is valid`);
… }
ada is valid
alan is valid
undefined
The negative amount for grace jumps straight to the next customer, which skips her remaining orders and her log line.
JavaScript continue Keyword Use Cases
- Skipping items that fail a check without nesting the rest of the body in an
if - Ignoring blank, invalid, or already processed entries in a loop
- Moving to the next item of an outer loop with a labeled
continue
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Leodanis Pozo Ramos • Updated Nov. 4, 2026