Last active
December 23, 2015 07:19
-
-
Save JRJurman/6600305 to your computer and use it in GitHub Desktop.
Someone asked how to get an odd or even value...
This file contains hidden or 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
| var cap = -Math.log(0); | |
| var ultimateSwitchCase = "switch(x.toString())\n{"; | |
| for( var i=0; i < cap; i++ ) { | |
| ultimateSwitchCase += "\tcase "+i+":\n\t\treturn \""+['even','odd'][i%2]+"\";\n"; | |
| } | |
| ultimateSwitchCase += "}"; | |
| eval(ultimateSwitchCase); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment