Skip to content

Instantly share code, notes, and snippets.

@sebbdk
Created November 11, 2012 01:07
Show Gist options
  • Select an option

  • Save sebbdk/4053237 to your computer and use it in GitHub Desktop.

Select an option

Save sebbdk/4053237 to your computer and use it in GitHub Desktop.
// 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