let str = "Bha785-900#";

function charCountNumber(str){
    const encodestr = [];
    
    for(let i =0;i<=str.length;i++){
       const char = str.charAt(i).toUpperCase();
       
       if(char >='A' && char<='Z'){
           const encodedValue = char.charCodeAt(0) - 64; 
           encodestr.push(encodedValue);
       }else{
           encodestr.push(char);
       }
    }
    
    return encodestr.join('');
}

console.log(charCountNumber(str));

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: