Last active
April 14, 2017 11:20
-
-
Save daredrum/7919b40f5c20464de7dddadd8f6d09c3 to your computer and use it in GitHub Desktop.
Binary in Javascript
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
| #Value swap without a third variable (^ XOR) | |
| var a = 1, b = 2; | |
| a ^= b; | |
| b ^= a; | |
| a ^= b; | |
| // a = 2, b = 1 | |
| #Condition for indexOf | |
| !~array.indexOf(value); // -1 -> 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment