Created
October 6, 2015 04:07
-
-
Save gartenfeld/3cd86f90142a21f0aa72 to your computer and use it in GitHub Desktop.
Converting from Base 10.
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
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