About 10,700,000 results
Open links in new tab
  1. How to break nested loops in JavaScript? - Stack Overflow

    The question was how to break a double for-loop, in that neither j or i run to 5. The only technical reason for favouring mine vs "break dance" is the case where you want i/j to show completion (==5) vs …

  2. How to break from nested loops in JavaScript? - Stack Overflow

    You can break out of nested Array.prototype.some () and/or Array.prototype.every () functions, as in my solutions. An added benefit of this approach is that Object.keys() enumerates only an object's own …

  3. How to stop a JavaScript for loop? - Stack Overflow

    I know this is a bit old, but instead of looping through the array with a for loop, it would be much easier to use the method <array>.indexOf(<element>[, fromIndex]) It loops through an array, finding and …

  4. Exit from if block in Javascript - Stack Overflow

    Nov 22, 2013 · You can do labeling as the other answer suggests, but it smells odds and it will definitely come up in code review. It will confuse readers of your code and increase the maintenance burden of …

  5. javascript - switch-case with return and break - Stack Overflow

    Aug 23, 2013 · break tells javascript to stop evaluating cases in the switch block. Code execution continues past the closing switch bracket. The return statement in the example code will indeed …

  6. javascript - Using break after default in switch statement when default ...

    May 10, 2019 · When JavaScript reaches a break keyword, it breaks out of the switch block. So if you have a default with break at the beginning of a switch statement, why wouldn't the default always be …

  7. How do I create a new line in Javascript? - Stack Overflow

    Mar 15, 2017 · How do I create a new line in Javascript? Asked 14 years, 8 months ago Modified 4 years, 2 months ago Viewed 975k times

  8. What is the JavaScript string newline character? - Stack Overflow

    Is \\n the universal newline character sequence in JavaScript for all platforms? If not, how do I determine the character for the current environment? I'm not asking about the HTML newline element (...

  9. javascript - Call break in nested if statements - Stack Overflow

    The break keyword doesn't work with if statements, does it?

  10. javascript - Early exit from function? - Stack Overflow

    May 30, 2018 · @dbme: Functions in JavaScript always return. The return statement is implicit if it hasn't been provided. The default return value is undefined, and that's what my primary solution provides. …