Skip to content

Instantly share code, notes, and snippets.

@drifterz28
Created April 1, 2014 18:38
Show Gist options
  • Select an option

  • Save drifterz28/9920272 to your computer and use it in GitHub Desktop.

Select an option

Save drifterz28/9920272 to your computer and use it in GitHub Desktop.
Change base in JS
// 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