Created
September 16, 2018 21:00
-
-
Save stanleykerr/d5919276d9caef8f50f55698b8955322 to your computer and use it in GitHub Desktop.
Assignment 2: Binary stuff
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
| String.prototype.swap = function() { return this.replace(/0/g, 'x').replace(/1/g, '0').replace(/x/g, '1'); }; | |
| Usage: "00110011".swap(); // Returns output 11001100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment