reverse – Convert number to alphabet letter in JavaScript


thanks for the sample code. On this basis, I will develop my translation of a number into letters. But a question for specialists, how do I find my way back, from letters back to the original number?
thank you very much in advance!

var alphabet = "1456789ABCFGHJKLMNPQRSTUVWXYZ";
var result = "";


function printToLetter(number){
    var ergenis;
    var charIndex = number % alphabet.length;
    var quotient = number/alphabet.length;
    if(charIndex-1 == -1){
        charIndex = alphabet.length;
        quotient--;
    }
    result =  alphabet.charAt(charIndex-1) + result;
    if(quotient>=1){
        printToLetter(parseInt(quotient));
    }else{

      ergebnis = result;
        result = "";
    }
return ergebnis;
}