About 320,000 results
Open links in new tab
  1. JavaScript Break and Continue - W3Schools

    The break statement "jumps out" of a loop. The continue statement "jumps over" one iteration in the loop.

  2. break - JavaScript | MDN - MDN Web Docs

    Mar 13, 2025 · The break statement terminates the current loop or switch statement and transfers program control to the statement following the terminated statement. It can also be used to jump past a labeled statement when used within that labeled statement.

  3. Exit a While loop based on two conditions - Stack Overflow

    Sep 13, 2012 · You could try a while loop that handles one condition, and inside the while loop, you have an if statement that checks the other condition. Example: while (one condition) { if (other condition) { do something; } }

  4. JavaScript break Statement - W3Schools

    The break statement breaks out of a switch or a loop. In a switch, it breaks out of the switch block. This stops the execution of more code inside the switch. In in a loop, it breaks out of the loop and continues executing the code after the loop (if any).

  5. JavaScript Break Statement - GeeksforGeeks

    Nov 19, 2024 · In JavaScript, we can use a break statement with a label to exit from a specific loop, even if it’s nested inside another loop. This is useful when you need to break out of a nested loop structure, and just using a simple break would only exit the innermost loop.

  6. JavaScript break Statement (with Examples) - Programiz

    We can terminate a while loop using the break statement. For example, // Program to find the sum of positive numbers // the while loop runs infinitely // loop terminates only when user enters a negative number let sum = 0; // infinite loop while (true) { // get number input let num = Number(prompt("Enter a number: "));

  7. JavaScript Break and Continue - GeeksforGeeks

    Feb 12, 2025 · Use break when you need to exit a loop entirely. Use continue when you want to skip specific iterations but continue looping. Use labels to control nested loops effectively.

  8. JavaScript break

    Use the break statement to terminate a loop including for, while, and do...while prematurely. The break statement terminates the enclosing loop in a nested loop. To terminate the nested loop, you use a label statement.

  9. How to break from a (for, while) Loop in JavaScript | Reactgo

    May 14, 2022 · In this tutorial, we are going to learn about how to break from a for loop and while loop with the help of break statement in JavaScript.

  10. How to Break Out of a While Loop in JavaScript - webdevtutor.net

    Mar 17, 2025 · Breaking out of a while loop in JavaScript gives you control over the loop's execution and allows you to efficiently manage your code flow. Choose the method that best suits your specific use case to effectively break out of a while loop.

  11. Some results have been removed
Refresh