这是我的代码
const caesar = function(x, y) {
let alphaListLower = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
let alphaListUpper = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
let userInput = x.split("")
let result = []
for(let i = 0; i < userInput.length; i++){
for(let e = 0; e < alphaListUpper.length; e++){
if (userInput[i] === alphaListLower[e] ){
if(e+y < 26){
result.push(alphaListLower[e+y])
}else{
result.push(alphaListLower[e+y-26])
}
}else if(userInput[i] === alphaListUpper[e] ){
if(e+y < 26){
result.push(alphaListUpper[e+y])
}else{
result.push(alphaListUpper[e+y-26])
}
}else if(userInput[i] === "!" || "," || " "){
result.push(userInput[i])
}
}
}
result = result.join("")
return result
};
如果我给出了一个论点,"你好,世界!它应该回来了!"