📜  多基转换 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:21.728000             🧑  作者: Mango

代码示例1
//Only for bases 2 through 9 
function mulBase(num, base) {
    var s = new Stack();
    do {
        s.push(num % base);
        num = Math.floor(num /= base);
    } while (num > 0);
    let converted = "";
    while (s.length() > 0) {
        converted += s.pop();
    }
    return converted;
}