Skip to content

Instantly share code, notes, and snippets.

@gartenfeld
Created October 6, 2015 04:07
Show Gist options
  • Save gartenfeld/3cd86f90142a21f0aa72 to your computer and use it in GitHub Desktop.
Save gartenfeld/3cd86f90142a21f0aa72 to your computer and use it in GitHub Desktop.
Converting from Base 10.
var num = "27019",
base = 16,
output = '';
while (num > 0) {
digit = num % base;
num = (num - digit) / base;
if (digit > 9) {
digit = String.fromCharCode(digit + 55);
}
output = digit + output;
}
console.log(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment