Skip to content

Instantly share code, notes, and snippets.

@istro
Created November 30, 2012 02:06
Show Gist options
  • Save istro/4173321 to your computer and use it in GitHub Desktop.
Save istro/4173321 to your computer and use it in GitHub Desktop.
blah
if (condition1) {
alert(1);
}else if (condition2) {
alert(2);
reset();
}else if (condition3) {
alert(3);
reset();
}else{
return true;
}
// crazy awesome-looking ternary + switch statement
---------------------------------------------------
scenario = condition1 ? case1 : condition2 ? case2 : condition3 ? case3 : true
switch(scenario){
case1:
alert(1);
break;
case2:
alert(2);
break;
case3:
alert(3);
break;
true:
return true;
}
if (scenario == case1 || case2) {
reset();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment