Created
November 11, 2012 01:07
-
-
Save sebbdk/4053237 to your computer and use it in GitHub Desktop.
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
| // Numbers with a leading 0 use a radix of 8 (octal) | |
| var result = parseInt('0101'); | |
| // Numbers that start with 0x use a radix of 16 (hexidecimal) | |
| var result = parseInt('0x0101'); | |
| // Numbers starting with anything else assumes a radix of 10 | |
| var result = parseInt('101'); | |
| // Or you can specify the radix, in this case 2 (binary) | |
| var result = parseInt('0101', 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment