Skip to content

Instantly share code, notes, and snippets.

@kevincennis
Created September 21, 2012 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevincennis/3762778 to your computer and use it in GitHub Desktop.
Save kevincennis/3762778 to your computer and use it in GitHub Desktop.
Block labels in JS
function isEven(val){
evaluate: { // Block label, not an object literal
if ( val % 2 == 0 ) break evaluate;
return false;
}
return true;
}
isEven(4) // true
isEven(7) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment