Skip to content

Instantly share code, notes, and snippets.

@carlosrojaso
Created May 14, 2014 21:17
Show Gist options
  • Save carlosrojaso/acbb06168d91e13b8e24 to your computer and use it in GitHub Desktop.
Save carlosrojaso/acbb06168d91e13b8e24 to your computer and use it in GitHub Desktop.
JS Switch
// A switch statement
switch ( foo ) {
case "bar":
alert( "the value was bar -- yay!" );
break;
case "baz":
alert( "boo baz :(" );
break;
default:
alert( "everything else is just ok" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment