Last active
February 7, 2021 18:20
-
-
Save johnloy/bcdd57bc75d6d5a715dc340184c45a37 to your computer and use it in GitHub Desktop.
Convert the string representation of a number to another base
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 convertFromBaseToBase(str, fromBase, toBase) { | |
var num = parseInt(str, fromBase); | |
return num.toString(toBase); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: https://stackoverflow.com/questions/1337419/how-do-you-convert-numbers-between-different-bases-in-javascript