Created
November 30, 2012 02:06
-
-
Save istro/4173321 to your computer and use it in GitHub Desktop.
blah
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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