-
-
Save LottieVixen/ae19a4d4b80e2ba66552b73d75638576 to your computer and use it in GitHub Desktop.
This file contains 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
function h2b(hexin){ | |
return parseInt(hexin, 10).toString(2); | |
} | |
//from http://stackoverflow.com/a/12987042 | |
function d2h(n){return n.toString(16).toUpperCase()} | |
function conv(hexin){ | |
console.log('0x'+d2h(hexin)+':'+h2b(hexin)); | |
} | |
/* | |
#Example usage | |
conv(0x1F); | |
#Example output | |
0x1F:11111 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment