SOURCE

function isUpperCase(ch) {
    return ch >='A' && ch <='Z';
}

function isLowerCase(ch) {
    return ch >='a' && ch <='z';
}

let password = 'YUAZzhi1987';
function switchPassword(pw) {
    let str = pw.split('');
    console.log(str)
    for(let i=0; i<str.length; i++) {
        if(isUpperCase(str[i])){
            if(str[i]=='Z'){
                str[i] = 'a';                
            }else{
                str[i] = String.fromCharCode(str[i].charCodeAt(0)+1).toLowerCase();
            }
        }else if(isLowerCase(str[i])){
            if((str[i]=='a')||(str[i]=='b')||(str[i]=='c')){
                str[i] = '2';
            }else  if((str[i]=='d')||(str[i]=='e')||(str[i]=='f')){
                str[i] = '3';
            }else  if((str[i]=='g')||(str[i]=='h')||(str[i]=='i')){
                str[i] = '4';
            }else  if((str[i]=='j')||(str[i]=='k')||(str[i]=='l')){
                str[i] = '5';
            }else  if((str[i]=='m')||(str[i]=='n')||(str[i]=='o')){
                str[i] = '6';
            }else  if((str[i]=='p')||(str[i]=='q')||(str[i]=='r')||(str[i]=='s')){
                str[i] = '7';
            }else  if((str[i]=='t')||(str[i]=='u')||(str[i]=='v')){
                str[i] = '8';
            }else  if((str[i]=='w')||(str[i]=='x')||(str[i]=='y')||(str[i]=='z')){
                str[i] = '9';
            }
        }else{
            str[i]=str[i];
        }
    }
    return str.join('');
}
console.log(switchPassword(password))
console 命令行工具 X clear

                    
>
console