Created
September 29, 2016 18:26
-
-
Save serjoscha87/c4bf67f50e468d3576ac9119db565bd9 to your computer and use it in GitHub Desktop.
JS: Messing with other peoples head - or how to complicate a dual switch case
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
| <!-- ... html html html --> | |
| <script src="vendor.js"></script> | |
| <script src="switch.js"></script> | |
| <script src="another_vendor.js"></script> | |
| <script src="switch.js"></script> | |
| <!-- html html html... --> |
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
| (function(ⵑⵑ){ | |
| ⵑⵑ&&( function(){ | |
| console.info("second call of switch.js"); | |
| }())||!ⵑⵑ&&( function(){ | |
| console.info("first call of switch.js"); | |
| }()); | |
| }(((window.foo || (window.foo={ⵑ:0})), window.foo.ⵑ++))); | |
| /* | |
| This is just a massive (senseless) complicated switch snippet that executes two different parts of code when included two times times | |
| */ |
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
| /* | |
| this should make clear what is happening here | |
| */ | |
| (function(switcher){ | |
| switcher &&( function(){ | |
| console.info("second"); | |
| }()) || !switcher && ( function(){ | |
| console.info("first"); | |
| }()); | |
| }(((window.foo || (window.foo={switcher:0})), window.foo.switcher++))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment