Created
April 1, 2014 18:38
-
-
Save drifterz28/9920272 to your computer and use it in GitHub Desktop.
Change base in JS
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
| // base 2 to base 16 | |
| var i = 255; | |
| i.toString(16); | |
| //output "ff" | |
| // base 16 to base 2 | |
| var f = 'ff'; | |
| parseInt(f, 16); | |
| // output 255 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment