Skip to content

Instantly share code, notes, and snippets.

@blainsmith
Created August 7, 2013 13:27
Show Gist options
  • Save blainsmith/6174025 to your computer and use it in GitHub Desktop.
Save blainsmith/6174025 to your computer and use it in GitHub Desktop.
Javascript Stuff
// Break a loop
var i = 0;
theAnswerToTheUniverse: while ( true ) {
console.log( ++i );
if ( i === 42 ) break theAnswerToTheUniverse;
}
// Break an if
myTest: if ( condition ) {
// some code...
if ( anotherCondition ) break myTest;
// more code if anotherCondition is falsy...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment